-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngNonBindable can't handle unescaped { characters #11859
Comments
A bit of brainstorming, after taking a look at lexer.ts:
Anyway, I feel I have a good understanding of how to approach the issue (using the first approach, I'd say). @vicb should I submit a PR or is your work on this too conflicting? |
Please go ahead and submit a pr. Thanks |
What is the reason that single braces must be escaped? The project I am working on includes a lot of templates with LaTeX math expressions of this sort: \frac{2x+3}{x^{-1}+5} Which is very inconvenient to have to escape. I realize double braces are for binding, but single braces used to be okay in RC4 but since upgrading all of my (hundreds) of templates are broken. |
This is due to the parsing of ICU expansion forms - http://userguide.icu-project.org/formatparse/messages. If you don't need i18n at all, I don't know whether or not there is a way to remove it altogether - @vicb will know much more about this than me (and a way of opting out might make sense?) Regardless, your options now are to either escape the strings altogether, or the |
Sorry, there is currently no way to opt-out |
Any word on if this is on the docket/there's a different approach to solve this? I'm just trying to show a simple code example in one my template and it's freaking out. |
For everyone interpreting the angular error message too literally (like me), it doesn't have to be escaped like this:
You can also escape it like that:
Still not perfect, but managable. |
Anything new on this? I am writing a KaTeX Component and it would be nice to be able to pass arbitrary TeX strings through to the Component. |
I'm writing webpack loader which can transform code snippets in html files and highlight them https://github.com/anjmao/ng-snippets-loader. I have a problem with javascript code snippets, because of |
Im facing this problem using MathJax |
Same problem for syntax highlighter support... |
Ran into a similar issue. The following code has been working fine for a while now (potentially since Angular v2):
However, since upgrading to ng9, it's now spitting out a very cryptic error message:
Can resolve either by removing the curly braces or removing i18n. |
I can totally see hoe this one is confusing as it is not clear what is the intent of Fixing this one properly will require review of all Angular specific constructs in relation to |
In Angular 13 a simple single { produces |
So still no progress on this in Angular 16? I have:
and I get:
As soon as I do a search for |
Same issue here. I'm hoping with the new template control flow work (#50719 etc) that this will get some eyes. For now, my only workaround has been to define my code snippet in a separate file, and have it loaded at runtime, for example instead of this: <pre><code>
function myFunction() {
return 1 + 1;
}
</code></pre> which causes the <pre><code src="assets/myFunction.js"></code></pre> and define a component/directive with selector |
I'm submitting a ... (check one with "x")
Current behavior
<div>Test binding: {{2 + 2}}</div>
=>
Test binding: 4
<div ngNonBindable>Test non binding: {{2 + 2}}</div>
=>
Test binding: {{2 + 2}}
<div>Test non binding: {2 + 2}</div>
=> Template parse errors, the "(Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)" message.
This is a problem because precisely due to the fact that they are [ngNonBindable] marked elements,
"{{ '{' }}"
doesn't produce the expected result.Expected behavior
As the escaping of
{
characters isn't possible inside [ngNonBindable] elements so it's the compiler's job to ignore them altogether, I believe.<div>Test non binding: {2 + 2}</div>
=>
Test binding: {2 + 2}
Reproduction of the problem
here => http://plnkr.co/edit/GSzwEUyXyY1qDabjpEL1?p=preview
The text was updated successfully, but these errors were encountered: