javascript - 使用angular給圖片動態賦值src屬性出現unsafe的情況
問題描述
百度過后,在appmodule中設置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是沒有效果
想問一下大家還有什么其他辦法能去掉這個unsafe
html代碼: <p class='user_pic'><img src='http://www.leifengta.com.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...
相關文章:
1. golang - 用IDE看docker源碼時的小問題2. 我何時應該在Java中使用JFrame.add(component)和JFrame.getContentPane()。add(component)3. html5和Flash對抗是什么情況?4. 運行python程序時出現“應用程序發生異常”的內存錯誤?5. html - css氣泡,實現“倒三角(不知道算不算三角了)”可透明的。6. 利用IPMI遠程安裝centos報錯!7. 前端 - @media query 使用出現的問題?8. phpstudy8.1沒集成mysql-front9. javascript - 請指條明路,angular的$event,在select中卻是undefined?10. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””

網公網安備