如何使用AngularJS当我逃避页面上显示大括号? [英] How do I escape curly braces for display on page when using AngularJS?

查看:460
本文介绍了如何使用AngularJS当我逃避页面上显示大括号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望用户看到双大括号,但角度会自动绑定它们。这是<一个相反的情况下href=\"http://stackoverflow.com/questions/12866447/$p$pvent-double-curly-brace-notation-from-displaying-momentarily-before-angular-j\">this问题他们想去的地方看不到用于页面加载时,结合大括号内。

我希望用户看到这一点:

 我的名字是{{person.name}}。

但角替换 {{person.name}} 的值。我想这可能工作,但依然棱角分明的值替换它:

 &放大器;#123;&放大器;#123; person.name}}

Plunker: http://plnkr.co/edit/XBJjr6uR1rMAg3Ng7DiJ


解决方案

 &LT; code NG-非绑定&GT; {{person.name}}&LT; / code&GT;

文档@ <一个href=\"http://docs.angularjs.org/api/ng.directive:ngNonBindable\">http://docs.angularjs.org/api/ng.directive:ngNonBindable

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:

&#123;&#123;person.name}}

Plunker: http://plnkr.co/edit/XBJjr6uR1rMAg3Ng7DiJ

解决方案

<code ng-non-bindable>{{person.name}}</code>

Documentation @ http://docs.angularjs.org/api/ng.directive:ngNonBindable

这篇关于如何使用AngularJS当我逃避页面上显示大括号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆