In my backend application, I have a spray route that pops the .xls file with
FileUtils.readAllBytes(xlsFile)
In my frontend application, I use angularjs with the Restangular module, so I need to get my .xls file and upload it to the user's computer.
In my code
Restangular.one("localhost:9090/excel")
.get()
.then(function(response){
alert("Excel is here!");
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/xls,' + encodeURIComponent(response);
hiddenElement.download = 'reporte-anual.xls';
hiddenElement.click();
});
but this is only a warning.
How can i achieve this?
Thank you all
source
share