ng 1.2 ng-bind-html 用法

Posted on 2017-12-14 15:50  lianfeng  阅读(263)  评论(0)    收藏  举报

使用ng-bind-html渲染html字符串时需要在控制器外注册$sec 过滤器

//过滤器渲染html字符串
app.filter('to_trusted',['$sce',function($sce){
return function(text){
return $sce.trustAsHtml(text);
};
}]);
 
//dom元素
<p ng-bind-html="signaa | to_trusted"></p>

 

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3