Say I want to display the following string - including the {{ }}
- in an Angular 2+ template:
Hello {{name}}, how are you?"
NB. The whole string will be hard-coded, it won't come from a variable.
What's the best way to escape the curly braces so that they're not considered an interpolation?
I have something that works but it doesn't look super clean:
Hello {{ '{{' }}name}}, how are you?
There is special built-in attribute ngNonBindable
that can be applied like:
<ng-container ngNonBindable>
Hello {{name}}, how are you?"
</ng-container>
or
<div ngNonBindable>
Hello {{name}}, how are you?"
</div>
if you have some container
Plunker Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With