Native transfer plugin - not available after installation in ionic2

I installed my own TRANSFER plugin in my application for ionic 2 in 2 steps:
1. ionic plug-in add cord-file-translation plugin
2. npm install --save @ ionic-native / transfer

After that, I imported the plugin at home.ts.
  Import {Transfer} from '@ ionic-native / transfer'

I tried to use the plugin to load the file var ft = new Transfer ();

But I can’t use ft var, because the migration plugin looks like it is unavailable. If I write ft.upload (), I get an error: "upload" does not exist in the "Transfer" type .

My technologies:
Cordoba CLI: 6.4.0
Ionic Framework version: 2.3.0
Ionic CLI version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4

In the previous version of my application, when using the Ionic Framework Version: 2.0.0-rc.5 / Ionic App Scripts Version: 1.0.0 everything worked fine.

Does anyone have a solution? Thanks in advance.

+2
source share
1 answer

In 3.1.0 version of Ionic Native, you should use the plugin as a provider.

  • Import it into app.module.ts and set as provider

     import {Transfer} from '@ionic-native/transfer'
    
     @ngModule({
       //...
       providers:[
           Transfer,
           ..]
    
  • Paste into the component / provider where you need to use it.

    constructor(private fileTransfer:Transfer){}
    
  • Use an object fileTransfer.

: Ionic Native Transfer

+3

Source: https://habr.com/ru/post/1673748/


All Articles