简体   繁体   中英

Display html tags in angular template, don't render it

I want to write some information about html tags in angular app. I am not able to figure how to display html tags in inside angular template without rendering html.

eg

component.html

 <p> you can use <code> </p> </code> tag for paragraph </p>

Expected:

you can use </p> tag for paragraph

One way is to create variable in component and interpolate it in view. But I don't think to create so many variables only for single tag text.

eg component.html

 <p> you can use <code> {{myPTag}} </code> tag for paragraph </p>

component.ts

... 
myPTag = "</p>"
...

dont use '<' or '>' instead use &lt; and &gt;

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