AngularJS: the <a> tag does not work on the url generated by $ sce.trustAsResourceUrl (fileURL);
I have a temp url for blob using:
var file = new Blob([data], {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
Then I use $sceto make angular a trusted URL:
$scope.contentStream = $sce.trustAsResourceUrl(fileURL);
Then I use contentStreamin the anchor tag:
<a href="{{contentStream}}" download="Name Of File">Download File</a>
All this works fine, the only problem is that it once contentStreamappears in the tag a, the link looks like unsafe:blob:http%3A//192.168.88.110%3A8989/0e62a86e-4cb6-4603-8895-3f238ea8c55c, and when I click on the link, it doesn’t work. I realized what unsafe:causes the problem, then I take the same link, placing it on a new tab without unsafe:which the pdf file receives.
My question is:
How to remove unsafe:before it contentStreamwill be displayed by the browser and it will still be safe for angular to trust the URL?
+3