我试图使用$sanitize
provider和ng-bind-htm-unsafe
指令来允许我的控制器将HTML注入到DIV中.
然而,我无法让它工作.
<div ng-bind-html-unsafe="{{preview_data.preview.embed.html}}"></div>
我发现这是因为它是从AngularJS中删除的(谢谢).
但是如果没有ng-bind-html-unsafe
,我会得到这个错误:
我试图使用$sanitize
provider和ng-bind-htm-unsafe
指令来允许我的控制器将HTML注入到DIV中.
然而,我无法让它工作.
<div ng-bind-html-unsafe="{{preview_data.preview.embed.html}}"></div>
我发现这是因为它是从AngularJS中删除的(谢谢).
但是如果没有ng-bind-html-unsafe
,我会得到这个错误:
app
中包含ngSanitize
个模块ng-bind-html
the original html
content. No need to do anything else in your controller. The parsing and conversion is automatically done by the ngBindHtml
directive. (Read the How does it work
section on this: $sce). So, in your case <div ng-bind-html="preview_data.preview.embed.html"></div>
would do the work.