I want the user to see double curly braces, but Angular binds them automatically. This is the opposite case of this question where they want to not see curly braces used for binding when the page is loading.
I want the user to see this:
My name is {{person.name}}.
But Angular replaces {{person.name}}
with the value. I thought this might work, but angular still replaces it with the value:
{{person.name}}
Plunker: http://plnkr.co/edit/XBJjr6uR1rMAg3Ng7DiJ
To match literal curly braces, you have to escape them with \ . However, Apex Code uses \ as an escape, too, so you have to "escape the escape". You'll need to do this almost every time you want to use any sort of special characters in your regexp literally, which will happen more frequently than not.
Curly brackets are commonly used in programming languages such as C, Java, Perl, and PHP to enclose groups of statements or blocks of code.
Interpolation in Angular In simple terms, when you send data from an Angular component to the template using the mustache syntax or what you would call double curly brackets (these: “{{ … }}”) it is called interpolation. You can use it with variables, objects and even functions.
Data is represented in name/value pairs. Curly braces hold objects and each name is followed by ':'(colon), the name/value pairs are separated by , (comma). Square brackets hold arrays and values are separated by ,(comma).
<code ng-non-bindable>{{person.name}}</code>
Documentation @ ngNonBindable
Edit: adding \ slash between brackets inside the quotes works
{{ "{{ person.name }\}" }}
this too .. by passes angular interpreting
{{ person.name }<!---->}
this too ..
{{ person.name }<x>} {{ person.name }<!>}
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