Progress event in cordovaFile


#1

I managed to use the $cordovaFile plugin in ngCordova , my only problem is with the function:

   $cordovaFile
                            .downloadFile(source, filePath, true)
                            .then(function (result) {
                                // Success!
                              
                            }, function (err) {
                                
                            }, function (progress) {
                                // constant progress update
                              
                            });

How do i get the percentage of the progress from the progress object ? The documentation doesn’t say anything about it and printing to the console returns an [object Object ]


#2

use JSON.stringify to read the object like

alert(JSON.stringify(progress));

you can get percentage with

progress.loaded*100/progress.total;


#3

Yes that solved it ! thanks mate