我正在写一个Firefox插件。我有一个非常简单的代码:
var ANG_APP = angular.module('zooniversexpert', [])
.config(['$compileProvider', function( $compileProvider ) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|http?):/);
}
])
.controller('BodyController', ['$scope', function($scope) {
this.gallery = [{url:'http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D35_Season%202_Set%201_EK006076.JPG'}];
}]);
gallery
数组包含url
个键http://zooniverse-export.s3-website-us-east-1.amazonaws.com/21484_1000_D35_Season%202_Set%201_EK006076.JPG
的单个元素。
我的HTML在这里:
<body ng-controller="BodyController as BC">
<img ng-src="aEntry.url" ng-repeat="aEntry in BC.gallery"/>
</body>
但是图像无法加载,它不断发出此错误:
对文档的检查表明这是Angular试图加载的内容:
<img xmlns="http://www.w3.org/1999/xhtml" ng-src="aEntry.url" ng-repeat="aEntry in BC.gallery" class="ng-scope" src="unsafe:aEntry.url" />
请注意unsafe:aEntry.url
。