0

I have a component (ItemDetailsPage) that is importing a helper service

import { Helper } from './../../app/Helper';

and in the constructor I have

constructor(public viewCtrl: ViewController, public navCtrl: NavController, public navParams: NavParams, 
    public helper: Helper...)

In Helper.ts I have the following:

import { ItemDetailsPage } from './../pages/item-details/item-details';

and I use it like that:

showItemWindow() {
    let itemModal = this.modalCtrl.create(ItemDetailsPage, null, { cssClass: "modal-fullscreen" });
    itemModal.present();
}

When doing the above, I get "cannot resolve all parameters for ItemDetailsPage... I understand that it's because of a circular dependency. I can move showItemWindow to another component and it works but the reason I put it in the helper, is because I need it from 3 different pages and I wanted one place to open this window.

Is there another cleaner solution for this or moving it to 3 different component is the right one? Thanks

Amos
  • 1,321
  • 2
  • 23
  • 44

1 Answers1

0

Notice how you have 3 periods ... after your declaration of the Helper class in the constructor.Your constructor method should look like below.

constructor(public viewCtrl: ViewController, public navCtrl: NavController, public navParams: NavParams, 
    public helper: Helper)
fitzmode
  • 1,007
  • 1
  • 18
  • 29