javascript - 使用angular給圖片動(dòng)態(tài)賦值src屬性出現(xiàn)unsafe的情況
問題描述
百度過后,在appmodule中設(shè)置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是沒有效果
想問一下大家還有什么其他辦法能去掉這個(gè)unsafe
html代碼: <p class='user_pic'><img src='http://www.4tl426be.cn/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. java中返回一個(gè)對象,和輸出對像的值,意義在哪兒2. docker網(wǎng)絡(luò)端口映射,沒有方便點(diǎn)的操作方法么?3. mysql - 在不允許改動(dòng)數(shù)據(jù)表的情況下,如何優(yōu)化以varchar格式存儲的時(shí)間的比較?4. docker start -a dockername 老是卡住,什么情況?5. css3 - 純css實(shí)現(xiàn)點(diǎn)擊特效6. apache web server 怎么限制某一個(gè)網(wǎng)站對服務(wù)器資源的占用?7. javascript - 關(guān)于apply()與call()的問題8. docker - 各位電腦上有多少個(gè)容器啊?容器一多,自己都搞混了,咋辦呢?9. 安全性測試 - nodejs中如何防m(xù)ySQL注入10. python - pandas dataframe如何對某列的空數(shù)據(jù)位置進(jìn)行update?update的函數(shù)是自定義的,參數(shù)是同一行的另外兩列數(shù)據(jù)
