Can't resolve all parameters for HomePage: ([object Object], [object Object], ?)

import { Component } from ‘@angular/core’;
import { NavController , ModalController } from ‘ionic-angular’;
import { EmployeePage } from ‘./…/employee/employee.ts’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})

export class HomePage {
public employees : [] = [];
constructor(public navCtrl: NavController,public modalCtrl: ModalController, public employeeProvider : EmployeeProvider) {

}
ionViewDidEnter() {

        this.employeeProvider.createPouchDB();

        this.employeeProvider.read()
            .then(employees => {
                this.employees = employees;
            })
            .catch((err)=>{});

}

showDetails(employee) {
    let modal = this.modalCtrl.create(EmployeePage, { employee: employee });
    modal.present();
}  

}

Hello,
yous signature of your constructor in homepage contains 4 parameter. You must call our Homepage with this 4 parameters.

One parameter is
public employeeProvider : EmployeeProvider)
but I can not see a EmployeeProvider anywhere. Maybe a wrong import statement. see
import {EmployeePage ...

Btw, if you have vscode or simular, than you should use an extension that checks import statements and mark it as error.

Best regards, anna-liebt

1 Like