出于某种原因,AngularJS将“unsafe:”放在https网址前面。我已尝试设置aHrefSanitizationWhitelist
和imgSrcSanitizationWhitelist
,如下所示:
app.config( ['$compileProvider', '$routeProvider', function( $compileProvider, $routeProvider ){
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
]);
但无论我在上面做了什么改变,它都会产生这个URL。
unsafe:https://s3.us-east-2.amazonaws.com/test-bucket/58a0cfe00dea48a48633.png
我可以做些什么来阻止AngularJS在我的img urls面前放置不安全的东西......?
修改
流程我正在展示图片:
这是一个简短的例子:
<div ng-repeat="data in campaignData track by $index">
<img class="img-responsive"
ng-src="{{data.thumbnailFileKey}}"
Accept="image/jpeg, image/jpg, image/png" />
</div>