您的位置:首頁技術文章
文章詳情頁

javascript - 使用angular給圖片動態賦值src屬性出現unsafe的情況

瀏覽:121日期:2024-03-07 11:52:49

問題描述

百度過后,在appmodule中設置了app.config的值 $compileProvider.imgSrcSanitizationWhitelist(/^s*(https?|local|data):/);但是沒有效果

想問一下大家還有什么其他辦法能去掉這個unsafe

html代碼: <p class='user_pic'><img src='http://www.wxshucaidpc.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...

標簽: JavaScript
相關文章:
国产综合久久一区二区三区