角度HTML绑定 [英] Angular HTML binding
本文介绍了角度HTML绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写Angular应用程序,并且要显示HTML响应.
I am writing an Angular application and I have an HTML response I want to display.
我该怎么做?如果我仅使用绑定语法{{myVal}}
,它将对所有HTML字符进行编码(当然).
How do I do that? If I simply use the binding syntax {{myVal}}
it encodes all HTML characters (of course).
我需要以某种方式将div
的innerHTML
绑定到变量值.
I need somehow to bind the innerHTML
of a div
to the variable value.
推荐答案
正确的语法如下:
<div [innerHTML]="theHtmlString"></div>
仍在版本10.0.7
这篇关于角度HTML绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文