javascript - 使用angular給圖片動態賦值src屬性出現unsafe的情況
問題描述
百度過后,在appmodule中設置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是沒有效果
想問一下大家還有什么其他辦法能去掉這個unsafe
html代碼: <p class='user_pic'><img src='http://www.piao2010.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...
相關文章:
1. docker安裝后出現Cannot connect to the Docker daemon.2. 為什么我ping不通我的docker容器呢???3. android - webview 自定義加載進度條4. mysql - 怎么讓 SELECT 1+null 等于 15. javascript - 微信音樂分享6. 網頁爬蟲 - 用Python3的requests庫模擬登陸Bilibili總是提示驗證碼錯誤怎么辦?7. javascript - 微信小程序封裝定位問題(封裝異步并可能多次請求)8. 并發模型 - python將進程池放在裝飾器里為什么不生效也沒報錯9. linux - openSUSE 上,如何使用 QQ?10. python 怎樣用pickle保存類的實例?
