gpt4 book ai didi

javascript - $sce.trustAsHtml() 过滤掉 img

转载 作者:行者123 更新时间:2023-11-28 01:14:31 27 4
gpt4 key购买 nike

使用我在相关问题中找到的解决方案 ( 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com