简体   繁体   中英

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

I'me new to 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).

eg

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

Now the textbox htm should be shown as such. (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. But what about ng-model and how to prevent the expression from getting evaluated.

ng-non-bindable directive will do this!. :)

eg

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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