0

我将使用如下所示的 Ionic native Transfer 插件。问题就在这里。this.file.dataDirectory它显示错误[ts] Property 'dataDirectory' does not exist on type 'File'.。你能告诉我这个问题的解决方案是什么吗?

download() {
        const fileTransfer: TransferObject = 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
        });
    }
4

1 回答 1

0

Oh.. My bad :(

I have to install File plugin too :D

$ ionic cordova plugin add cordova-plugin-file --save
$ npm install --save @ionic-native/file
于 2017-06-08T07:34:52.843 回答