举个例子,如果我这样做:
var = "<a>Asd</a>";
<span>{{ var }}</span>
字符串打印为文本而不是 html,那么如何打印 html?
最佳答案
你应该使用 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>
关于javascript - 如何将 html 字符串打印为 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231630/