前端之家收集整理的这篇文章主要介绍了
ng-bind-html指令在渲染时删除样式属性,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我写作
<div ng-bind-html="slideContent"></div>
哪里
this.$scope.slideContent =
this.$sce.trustAsHtml("<img src='1.jpg' style='width: 231px'></img>");
angular删除样式属性,因此图像具有初始大小.
你怎么看?我怎么能避免这个?
谢谢!
在html
标签中使用ng-bind-html =“trustedHtml(resultList.section)”
并把这个
功能控制器
$scope.trustedHtml = function (plainText) {
return $sce.trustAsHtml(plainText);
}
<div ng-bind-html="trustedHtml(resultList.section)"></div>
原文链接:https://www.f2er.com/html/227163.html