ng 1.2 ng-bind-html 用法

Posted on 2017-12-14 15:50  lianfeng  阅读(249)  评论(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>

 

Copyright © 2024 lianfeng
Powered by .NET 8.0 on Kubernetes