kaps
June 7, 2015, 7:34am
1
Hello,
I have a requirement where in whenever a user clicks on download button on the screen I generate a csv file on the server and send it back via response.
Now I want to download/open this dynamically generated file on my ionic app.
How can I do this? I haven’t used cordova plugins so far so no ideas on that front.
Can someone please guide me on this?
Taehwa
January 14, 2016, 12:21pm
2
I have a same issue. Could you resolve?
Anyone have suggestions for exporting excel files?
Hello,
Anyone found the solution for this. Suggests any idea. Thanks
kaps
July 24, 2016, 9:17am
5
The below might be helpful:
var targetPath = serverService.getDownloadLocation() + "attendance_" + todayStr +".xlsx";
var trustHosts = true
var options = {};
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
console.log('File download successful');
$ionicLoading.hide();
deferred.resolve(result);
}, function(err) {
console.log('File download failed');
console.log(err);
$ionicLoading.hide();
deferred.reject();
throw err;
}, function (progress) {
console.log('inside progress '+ progress.loaded);
//$timeout(function () {
// $scope.downloadProgress = (progress.loaded / progress.total) * 100;
//})
});
kaps
July 24, 2016, 9:17am
6
Simply inject the $cordovaFileTransfer plugin