Cordova file-transfer using promisses

Hi,

I download a pdf file using cordova file-transfer .

Also have a load method.

Both methods are working fine i just want to call loadpdf method just after the download is finished, so i will call itfrom the filesystem.

I try to start the promisse at the service and use then: this code is my attempt http://plnkr.co/ASB7LSCuCRvVLGI3Kqxf

Thank´s in advance

Not sure if there is a better way !

But i just add window.open inside the successCallback of the download method from cordova file-transfer plugin and this does the job i need wich is open the just downloaded file.

ft = new FileTransfer();
ft.download(
    encodeURI(lastUrl),
    p,
    function(entry) {
        window.open(entry.toURL(), '_system', 'location=yes,toolbar=yes,closebuttoncaption=Close PDF,enableViewportScale=yes,fullscreen=no');                                
    },                          
    function(error) {                                
        alert('Error'); 
        $ionicLoading.hide();
        alert("Download Error Source -> " + error.source);
    },
    false,
    null
);