I've been working on developing an Ionic application and encountered an issue with sending PDF files to a Laravel API. I decided to implement a file chooser for Ionic, but every time I try to upload the file, I get an error saying "Object(…) is not a function" at FileChooser.open. I've attempted various solutions to fix this problem, but none have worked so far.
Below is my fill.ts code:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { ComplaintProvider } from '../../providers/complaint/complaint';
import { FileTransfer, FileTransferObject, FileUploadOptions } from '@ionic-native/file-transfer/ngx';
import { FileChooser } from '@ionic-native/file-chooser/ngx';
import { File } from '@ionic-native/file/ngx';
import { FilePath } from '@ionic-native/file-path/ngx';
@IonicPage()
@Component({
selector: 'page-fill',
templateUrl: 'fill.html',
})
export class FillPage {
// Code goes here...
}
And here's the app.modules.ts:
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicModule, IonicApp, IonicErrorHandler } from 'ionic-angular';
// Other imports...
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage,
FillPage,
AddPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
HttpModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
LoginPage,
FillPage,
AddPage
],
providers: [
StatusBar,
SplashScreen,
AuthProvider,
FileTransfer,
FileChooser,
File,
FilePath,
ComplaintProvider,
{
provide: ErrorHandler,
useClass: IonicErrorHandler
},
]
})
export class AppModule {}