Bill Noble
Bill Noble

Reputation: 6734

Using Cordova FileTransfer in an ionic 2 app

I want to do file uploads in my ionic 2 app.

In my code I have:

var ft = new FileTransfer();

But FileTransfer is not recognised.

I have installed the Cordova file transfer plugin using:

cordova plugin add cordova-plugin-file-transfer

How do I import FileTransfer from the plugin so it is available.

I am using Angular 2 not Typescript.

Upvotes: 0

Views: 1867

Answers (1)

Gandhi
Gandhi

Reputation: 11935

Ensure to include cordova.js file in your respective html. Also register deviceready event listener and invoke plugin inside the listener.

In case of ionic platform, use platform.ready() which is an equivalent wrapper for deviceready event.

ionic.Platform.ready(function(){ //logic to invoke plugins });

Upvotes: 1

Related Questions