尝试解决 ng-src 信任问题
angular.module('App', []);
function Ctrl($scope, $sce) {
// Construct a dummy blob Url
var canvas = document.createElement("canvas");
canvas.width = 100;
canvas.height = 100;
var ctx = canvas.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,100,100);
canvas.toBlob(function(blob){
$scope.src = $sce.trustAsResourceUrl(URL.createObjectURL(blob));
// works...
var img = document.createElement("img");
img.src = $scope.src;
document.body.appendChild(img);
});
}