百度过后,在appmodule中设置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是没有效果想问一下大家还有什么其他办法能去掉这个unsafehtml代码: <div class="user_pic"><img src="{{item.UserID | imgSrc}}" width="100%;" height="178px;"></div>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;
}
});
添加回答
举报
0/150
提交
取消