Problem
I need a download link but the URL cannot be present until after the user clicks.
I have a working solution however it fills me with a dirty feeling...
Ideal Solution
This would be my preferred solution, however it is not supported
<a download ng-href="">
My Solution
Works but feels dirty.
scope.onClick = function () {
getUrl().then(url =>
angular.element(`<a download href="${url}"></a>`)[0].click()
);
};
Question
Is there a more elegant way to force the browser to always download a url (rather than load it into the browser window)?
Aucun commentaire:
Enregistrer un commentaire