How do I escape curly braces for display on page when using AngularJS?

后端 未结 8 1442
醉话见心
醉话见心 2020-11-27 02:28

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 fo

相关标签:
8条回答
  • 2020-11-27 03:17

    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 }<!>}
    
    0 讨论(0)
  • 2020-11-27 03:20

    Updated for Angular 9

    Use ngNonBindable to escape interpolation binding.

    <div ngNonBindable>
      My name is {{person.name}}
    </div>
    
    0 讨论(0)
提交回复
热议问题