使用我在相关问题中找到的解决方案 ( How do you use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe in Angular 1.2+ )
该页面上的过滤器答案似乎是最好的。
app.filter('unsafe', function($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
});
我的图像显示在 IE 10 中,但不会显示在 Chrome 或 Safari 中。有人可以帮我理解为什么吗?要查看我的困境,请访问 http://groceryads.com并从下拉列表中选择一个城市。
提前致谢。
最佳答案
似乎不是 Angular 问题,而是CSS的问题。如果选择城市后我在开发工具中运行以下命令,我会看到您的图像很好(Chrome):
$('#ifrss').contentWindow.window.$('img').css({width:100,height:100,maxWidth:'none'});
关于javascript - $sce.trustAsHtml() 过滤掉 img,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23999287/