由网友(时间会说真话)分享简介:如果只是举例我做的: VAR =< A>&性Asd LT; / A>中;<跨度> {{VAR}}< / SPAN> 该字符串如同打印文本而不是HTML,所以我怎么打印HTML?解决方案 您应该使用 NG-绑定-HTML 指令。 创建一个绑定,将innerHTML的评估结果...![idea 使用插件,提高工作效率](/d/file/2023/09-17/615c02502dd468da77d3fc4f9e017d33.png)
如果只是举例我做的:
VAR =< A>&性Asd LT; / A>中;<跨度> {{VAR}}< / SPAN>
该字符串如同打印文本而不是HTML,所以我怎么打印HTML?
解决方案![idea 使用插件,提高工作效率](/d/file/2023/09-17/615c02502dd468da77d3fc4f9e017d33.png)
您应该使用 NG-绑定-HTML
指令。
创建一个绑定,将innerHTML的评估结果 前pression成以安全的方式在当前元素
<任何NG绑定-HTML ={EX pression}> ...< / ANY>
If just for example I do:
var = "<a>Asd</a>";
<span>{{ var }}</span>
The string is printed like text and not as html, so how do I print the html ?
解决方案You should be using ng-bind-html
directive.
Creates a binding that will innerHTML the result of evaluating the expression into the current element in a secure way.
<ANY ng-bind-html="{expression}">
...
</ANY>
相关推荐
最新文章