如何使用AngularJS在文本中显示html标签[关闭](How to use AngularJS to show the html tag in the text [closed])
我想在html中显示一些数据,数据如下: <p>abcd efg hijk....(<a href=\"http:\/\/www.facebook.com\/stock\/NBR\">NYSE:NBR<\/a>),如你所见,有一些html标签,但是当我使用angularJS来显示这些数据时,浏览器无法将这些数据识别为html标签。
有人知道怎么做吗?
I want to show some data in the html, the data like this: <p>abcd efg hijk....(<a href=\"http:\/\/www.facebook.com\/stock\/NBR\">NYSE:NBR<\/a>),,as you see,there are some html tags, but when I use the angularJS to show these data, the Browser cannot recognize these data as html tag.
Anybody know how to do this?
最满意答案
您可以使用ngBindHtml
<ANY ng-bind-html="expression"> ... </ANY>假设你对$ scope.htmtText = ....有价值
<div ng-bind-html="htmtText"></div>请参阅文档
You can use ngBindHtml
<ANY ng-bind-html="expression"> ... </ANY>Say you have value on $scope.htmtText = .... then
<div ng-bind-html="htmtText"></div>See the documentation
更多推荐
发布评论