'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
Solution 1:[1]
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
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MohammedAli |

