Error Can not resolve all parameters for EditPage when reloading my Ionic App with -ionic serve

0

I have this error when reloading my Ionic App with -ionic serve :

  

Error: Can not resolve all parameters for EditPage: ([object Object],   [object Object], [object Object],?).

This is the EditPage typescript ( edit.ts ):

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { HomePage } from "../home/home";
import { IconsPage } from '../icons/icons';

@Component ({
  selector: 'page-edit',
  templateUrl: 'edit.html'
})

export class EditPage {
  position: number;
  notification = this.homePage.allNotifications[this.position];
  newDoneText: string = 'Hecho';
  newCancelText: string = 'Cancelar';

  constructor(public navCtrl: NavController,
              public iconsPage: IconsPage,
              public navParams: NavParams,
              public homePage: HomePage,
  ) {
    this.position = navParams.get('position');
  }

  openIcons() {
    this.navCtrl.push(IconsPage);
  }

  changeThisIconName() {
    this.notification.iconName = this.iconsPage.returnIconName();
  }
}

And that's how I call her and pass her the parameters ( home.ts ):

openEdit() {
    this.navCtrl.push(EditPage, {position: this.positionEditNotificationInAllNotifications});
  }

How can I solve it?

    
asked by RCODeGO 13.03.2018 в 16:32
source

1 answer

0

The error is inside your constructor:

  

Error: Can not resolve all parameters for EditPage: ([object Object], [object Object], [object Object],?).

Each element [object Object] represents a parameter within your constructor, that is, navCtrl is the first, iconsPage the second, navParams the third and homePage should be the fourth, is there the component in the route you declared?

Usually in the constructor only providers / services are injected, I would suggest to check if it is your case it is really necessary to inject the components so, if you need to use the same function / data in two different components, you could migrate the processes to a service.

    
answered by 28.03.2018 / 00:09
source