I am unable to download an image from an Amazon S3 URL, with an anchor tag in Angular. What am I missing?
URL
https://s3.amazonaws.com/nationalrx/card/national_test.png
HTML
div(ng-bind-html="trustedHtml")
CONTROLLER
$scope.html = '<a target="_self" ng-href="https://s3.amazonaws.com/nationalrx/card/national_test.png" download>Download NOW</a>';
$scope.trustedHtml = $sce.trustAsHtml($scope.html);
CONFIG
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|blob|):/);
$sceProvider.enabled(false) did not help
Directives like ng-href are not executed by ng-bind-html. Just use
href
: there is no reason to useng-href
.I would also avoid using ng-bind-html, BTW. Why don't you make the link part of your template, and store only the URL in the scope variable?