It's strange, but this task seems to be more straightforward in Internet Explorer than in Chrome or Firefox:
$scope.download = function() {
Restangular.one(myAPI)
.withHttpConfig({responseType: 'blob'}).customGET().then(function(response) {
//When using IE10, a save/open dialog appears with the file name filename.zip
window.navigator.msSaveOrOpenBlob(response, 'filename.zip');
//Chrome and Firefox download a file with a random name
var url = (window.URL || window.webkitURL).createObjectURL(response);
window.location.href = url;
});
};
Is there a way to replicate the behavior of IE10+ in other browsers? Specifically, is it possible to specify a file name and type (which will always be zip)?