百度过后,在appmodule中设置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);
但是没有效果
想问一下大家还有什么其他办法能去掉这个unsafe
html代码: <p class="user_pic"><img src="{{item.UserID | imgSrc}}" width="100%;" height="178px;"></p>
controller中:app.filter('imgSrc', function () {
return function (input) {
var src = '';
if (input == undefined) {
return;
}
$.ajax({
url: BaseURL + "/MainUser/LoadUserPersonalHomepageByUseriD?userID=" + input,
type: 'get',
async: false,
success: function (data) {
if (data.UploadIMG == null) {
src = '/img/tp.png'
} else {
src = data.UploadIMG
}
}
})
return src;
}
});
https://stackoverflow.com/que...