javascript - 使用angular给图片动态赋值src属性出现unsafe的情况
问题描述
百度过后,在appmodule中设置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是没有效果
想问一下大家还有什么其他办法能去掉这个unsafe
html代码: <p class='user_pic'><img src='https://www.haobala.com/wenda/{{item.UserID | imgSrc}}' 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; }});
问题解答
回答1:https://stackoverflow.com/que...
相关文章:

网公网安备