-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reusable modals #20263
Comments
This is not really a bug but more like a feature request ? |
Could be. But it looks like a bug/regression, breaking change, because it worked like that in Ionic 3 and our application broke after migrating to Ionic 4. |
Thanks for the issue. Can you provide some more clarification around your use case? Even in Ionic 3 modal components were not intended to be reusable. See the v3 docs here: https://ionicframework.com/docs/v3/api/components/modal/ModalController/#modal-controller |
Thanks I could not find the information that the modal controller object cannot be reused. But anyway I restructured the app logic to create a new page every time. We use a modal that opens every time the app resumes and the |
If you change modals back then all modals relying on ngOnInit / ngOnDestroy will break. |
Thanks for the issue. This has been resolved via #23341, and you will be able to reuse modal instances by writing them declaratively in Ionic Framework v6. We will have updated docs that show you how to do this. |
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:
Modals that are dismissed cannot be opened again. You need to create a new modal object before presenting. Modals cannot be reused.
Expected behavior:
In Ionic 3 I could create a modal and open and close it as much as I want to. I think reusing modal objects should be possible
Steps to reproduce:
See my repro project here. Open the modal by clicking open, dismiss it, click open again.
You can see that the browser console prints the log message from the modals onInit lifecycle hook but does not show the modals template.
Related code:
https://github.com/NiklasMerz/ionic-modal-repro
A sample application via GitHub
Other information:
Ionic info:
The text was updated successfully, but these errors were encountered: