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
Per design and best practice you can’t use ModalController and other Navigation/Pages/Components (AlertCtrl, NavigationCtrl, NavParams, your own pages and components, etc.) in your providers/services
Therefore, in any case, that’s your first problem
You’ve got different pattern to solve that. Spontaneously I would think about:
Having an abstract class you would extends in your pages and implementing your code there
Implementing for example the code in app.component.ts and using a provider with observable to trigger the action (in app.component you subscribe to the observable, in your pages/components you emit the events)
Another option (not that I’m necessarily a fan of this idea) is to have the service take whatever view controllers (such as a ModalController instance here) as a function parameter to any function that needs one. Each client page can inject one and pass it when calling the service function.