In my Angular app, I'm using ngResource
to send a GET request to a WebAPI server. It simply looks like this:
vm.exportCSV = function() {
languageResource.export(function(data) {
});
}
The server returns a response with the header Content-Type: text/csv
and content like this:
Key;Language;Value
1;Enlish;Blabla
2;German;blabla
I have added ng-click='vm.exportCSV'
to a link, and want to download the file returned by the request when clicked. I tried to do it like suggested here, but this simply gives me a file containing [object Object]
.
How can I accomplish this?