2017-11-29 4 views
1

this.file.dataDirectory zeigte Null, Ich habe Cordova global installiert, aber immer noch bin ich nicht in der Lage, eine Lösung zu finden.Was habe ich falsch gemacht?this.file.dataDirectory zeigte null in ionic2

download() { 

    const fileTransfer: FileTransferObject = this.transfer.create(); 

    const url = 'http://www.example.com/file.pdf'; 
    fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => { 
     console.log('download complete: ' + entry.toURL()); 
    }, (error) => { 
     // handle error 
    }); 
} 

Antwort

0

Verwendung

cordova.file.dataDirectory 

statt

this.file.dataDirectory