2 qq 37067285 qq_37067285 于 2017.08.30 11:22 提问

angular2动态给img赋值blob,报不安全错误

var app = angular.module( ‘myApp‘, [] ).config( [
‘$compileProvider‘,
function( $compileProvider )
{

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
// Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
}])



# 这是在网上找的答案,是angular11的,不明白到angular2中怎么写

1个回答

Simor
Simor   2017.08.30 15:01

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;
}
});

Csdn user default icon
上传中...
上传图片
插入图片