Angular 2, ionic. Can't resolve all options for HomePage
What am I missing next? I'm trying to use cordova-camera-plugins and ionic native ones, since Ionic 2, but after getting the ionic function, I get the following Runtime Error: "Can't resolve all parameters for HomePage: ([Object Object], [Object Object]), [ object Object], [object Object] ,?).
Home.ts
import { Component, Injectable } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ToastController } from 'ionic-angular';
// import { File } from '@ionic-native/file';
import { Diagnostic } from '@ionic-native/diagnostic';
import { CameraPreview, CameraPreviewOptions, CameraPreviewDimensions} from '@ionic-native/camera-preview';
declare var cordova: any;
@Component({
selector: 'page-home',
templateUrl: 'home.html',
})
@Injectable()
export class HomePage {
constructor(
private navCtrl: NavController,
private toastCtrl: ToastController,
// public file:File,
public diagnostic:Diagnostic,
public cameraPreview: CameraPreview,
public previewRect: CameraPreviewOptions
) { this.checkPermissions(); }
app.module.ts
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { Diagnostic } from '@ionic-native/diagnostic';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@NgModule({
declarations: [
MyApp,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
Diagnostic
],
providers: [
StatusBar,
SplashScreen,
Diagnostic,
{provide: ErrorHandler, useClass: IonicErrorHandler},
{provide: Diagnostic, useClass: Diagnostic}
]
})
export class AppModule {}
+3
source to share
1 answer
I used this same error and it has now been fixed. "Unable to resolve all options for HomePage: ([Object Object], [Object Object], [Object Object], [Object Object] ,?).
"?" might mean not recognized or something else, so try removing some of the parameters in the constructor and just declare them as a regular data member (above the constructor). For example, "public previewRect: CameraPreviewOptions".
+2
source to share