javascript - 使用angular給圖片動態(tài)賦值src屬性出現(xiàn)unsafe的情況
問題描述
百度過后,在appmodule中設(shè)置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是沒有效果
想問一下大家還有什么其他辦法能去掉這個unsafe
html代碼: <p class='user_pic'><img src='http://www.intensediesel.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...
相關(guān)文章:
1. mysql優(yōu)化 - 關(guān)于mysql分區(qū)2. javascript - ionic2 input autofocus 電腦成功,iOS手機鍵盤不彈出3. node.js - 在vuejs-templates/webpack中dev-server.js里為什么要exports readyPromise?4. java - Atom中文問題5. java - MySQL中,使用聚合函數(shù)+for update會鎖表嗎?6. 請教各位大佬,瀏覽器點 提交實例為什么沒有反應(yīng)7. objective-c - iOS開發(fā)支付寶和微信支付完成為什么跳轉(zhuǎn)到了之前開發(fā)的一個app?8. html5 - 如何實現(xiàn)帶陰影的不規(guī)則容器?9. vue.js - vue 打包后 nginx 服務(wù)端API請求跨域問題無法解決。10. javascript - 為什么這個點擊事件需要點擊兩次才有效果
