简体   繁体   English

如何在Angular js的ng-app内以纯htm显示标签

[英]How to display tags in plain htm inside ng-app of angular js

I'me new to Angular JS. 我是Angular JS的新手。 I wanted to know how to display the tags(or directive, expression etc.) written in my htm as such (present inside the ng-app). 我想知道如何显示这样写在我的htm中的标签(或指令,表达式等)(存在于ng-app中)。

eg 例如

<div ng-app="myExampleApp">
    <input type="text" ng-model="firstname"/>
    {{firstname}}
</div>

Now the textbox htm should be shown as such. 现在,文本框htm应该这样显示。 (instead of a text box getting rendered). (而不是呈现文本框)。 Please let me know how to escape them 请让我知道如何逃脱

One way is to use &lt and &gt and so on. 一种方法是使用&lt和&gt等。 But what about ng-model and how to prevent the expression from getting evaluated. 但是ng-model又如何防止表达式求值呢?

ng-non-bindable directive will do this!. ng-non-bindable指令将执行此操作! :) :)

eg 例如

<div ng-app="myExampleApp">
    <input type="text" ng-model="firstname"/>
    <label ng-non-bindable="">{{firstname}}</label>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM