I am returning a .csv file from my python/tornado backend.
for line in csv_lines:
self.write(line + '\n')
self.set_header('Content-type', 'text/csv')
Here is my current (angular) frontend
$scope.exportCsv = function() {
var route = _mkRoute();
window.open(route);
}
However, this was a bit of a workaround... I would prefer to do something like this.
$http.get(route).then(
function(response) {
// launch the download dialog box
},
function(error) {
// some error handling
}
);
However, no dialog box pops up when I use this approach.
Is there an "angular" way to launch a download dialog box after the request completes? I would have googled, but it was a bit hard for me to phrase this into a google-able term.
Thanks!