cmaresh
cmaresh

Reputation: 73

Importing Ionic-Native File plugin in Ionic 4

I am attempting to use the ionic native file plugin, but am receiving an error when attempting to run the app after installation

Partial app.module.ts file:


    ...
    import { File } from '@ionic-native/file';
    ...
    
    @NgModule({
      declarations: [AppComponent],
      entryComponents: [],
      imports: [
        ...
      ],
      providers: [
        ...
        File
      ],
      bootstrap: [AppComponent]
    })
    export class AppModule {}

Error in console is

Uncaught TypeError: Object(...) is not a function

enter image description here

Upvotes: 0

Views: 2265

Answers (1)

MohammedAli
MohammedAli

Reputation: 2519

install

ionic cordova plugin add cordova-plugin-file
npm install @ionic-native/file --save

import app.module.ts like this

import { File } from "@ionic-native/file/ngx";

providers: [
    File
]

Upvotes: 1

Related Questions