I'm trying to create a link that will download a JSON file like so
Controller
$scope.url = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj));
View
<a href="url" download="download.json">download</a>
But when I inspect the generated HTML, unsafe:
is prepended to the start of the href
value, which prevents the link from working.
I've unsuccessfully tried using various methods of the $sce
service to inform Angular that this URL should be trusted.