I'm trying to use $sce.trustAsUrl
, but it doesn't seem to work. My HTML looks like,
<a ng-href="{{img_src}}" target="_blank">the image</a>
and the Angular JS in question is like this,
$scope.img_src = $sce.trustAsUrl("data:image/jpeg;base64,/9j/4AAQS...");
I know I can try $sce.trustAsHtml
, but this seems like a hack. Am I doing something wrong, or is Angular just buggy?
Full example (JS fiddle): http://jsfiddle.net/njjkg8vr/