我正在尝试使用ng-bind-html-unsafe
属性在模板中插入 HTML。但由于某种原因,它不起作用。
我的代码:
<tr class="white two-button" ng-repeat="(key,value) in recommendations | ojoScoreFilter:ojoScore | relevancyScoreFilter:relevancyScore | orderBy:predicate:reverse">
<td>
<div ng-bind-html-unsafe="value.button"></div>
</td>
</tr>
我看不到 HTML。如果我更改ng-bind-html-unsafe="value.button"
为ng-bind-html-unsafe="{{value.button}}"
然后它显示 HTML 但在属性内,如下所示:
<div ng-bind-html-unsafe="<a class="action_hrefs full-width bgcolor10 purple-hover flat-button flat-white-button btn" data-value="947" href="#"><i class="fa fa-lock"></i> Unlock</a>"></div>