Closed ctfrancia closed 5 years ago
Hi there,
Thanks for the issue. I am going to close this as this is more of a support request and is not a bug in Ionic.
One thing you might be able to do is have an openModal
method in your Modal Service that accepts the component to use. This would allow you to avoid circular dependencies since you would not need to import the components into the modal service file itself.
Thanks for using Ionic!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Bug Report
Ionic version:
[x] 4.x
Current behavior:
Unable to create Modal Service that handles opening and closing Modals depending on what I try the errors are different but the result is the same.
Steps to reproduce:
Related code:
app.module.ts
modal.service.ts
ChatComponent
ProfileComponent
Other information:
forum conversation - ionic read about DI here - Medium read this as well - SO
Also, the App is a chat app. When you enter your home page you have profiles you can click which in the HomePage calls
this.modalService.openProfile()
and then when in the ProfileComponent you have the option to 'Send Message' which callsthis.modalService.openChat()
and then from within the ChatComponent you see the persons Avatar which you can clickthis.modalService.openProfile()
which makes it circular. Alternatively when you navigate to the ChatdashboardPage you have a list of your active chats. From there you can click on a chat and that callsthis.modalService.openChat()
and when you get there yep you guessed it you can click the avatar picture which callsthis.modalService.openProfile()
so there are two ways to enter this circle.I am also unable to split the components and put them on their respective parent, for example, I can't put the ChatComponent on the ChatDashboardPage.module because Angular can't find it, and likewise for ProfileComponent on the HomePage.module Ionic info: