Use cordovaToast for this feature. Here is an example to show the pdf download process
HTML
<ion-view > <div class="bar bar-subheader bar-positive" style="padding:0px;height: 8px;" > <progress id="progressbar" max="100" value="{{ downloadProgress }}" class="progress"> </progress> </div> <ion-content> </ion-content> </ion-view>
CSS
.progress { margin: 0 px; height: 8 px; background - color:
Js
if (window.cordova) { var url = '{{base_url}}/pdf_download/' + id; // Android var targetPath = 'file:///storage/sdcard0/' + 'fpl_' + id + '.pdf'; var trustHosts = true; var options = {}; $cordovaFileTransfer.download(url, targetPath, options, trustHosts) .then(function(result) { $cordovaToast .show('File downloaded successfully..', 'short', 'center') .then(function() { // success }, function() { // error }); console.log(result); }, function() { var alertPopup = $ionicPopup.alert({ title: 'No internet access', buttons: [{ text: 'OK', type: 'button-assertive' }] }); alertPopup.then(function() {}); }, function(progress) { var dnldpgs = progress.loaded.toString().substring(0, 2); $scope.downloadProgress = parseInt(dnldpgs); }); }
If in doubt. Please let me know. Thanks.
source share