-
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
bug: NavController.pop not working in nested outlets #28417
Comments
Thanks for the report. Here's a dev build if you are interested in testing a proposed fix: Install Example:
edit: You may need to test in a local project. StackBlitz sometimes has trouble installing our dev builds. |
Issue number: resolves #28417 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The common `IonRouterOutlet` was trying to inject another common `IonRouterOutlet` into `parentOutlet`: https://github.com/ionic-team/ionic-framework/blob/dc94ae01fe9e6c1b570559f0c8308b31e96cc5bf/packages/angular/common/src/directives/navigation/router-outlet.ts#L119 None existed, so this field was `null`. This is a problem if developers are using the module `IonRouterOutlet` since parent router outlets will not be currently injected because Angular is trying to use the common `IonRouterOutlet` not the module `IonRouterOutlet`: https://github.com/ionic-team/ionic-framework/blob/main/packages/angular/src/directives/navigation/ion-router-outlet.ts. The same goes for the standalone `IonRouterOutlet`. This resulted in things such as `NavController.pop` not working in nested outlets because the parentOutlet was not defined. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `IonRouterOutlet` now injects the correct router outlet instance for `parentOutlet` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.5.3-dev.11698328998.1a79f815`
Thanks for the issue. This has been resolved via #28421, and a fix will be available in an upcoming release of Ionic Framework. Please feel free to continue testing the dev build. and let me know if you run into any issues. |
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. |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
When the user navigates from the main page to a child page with tabs and then clicks on the button which invokes NavController.pop nothing happens. Please note that it works fine with the ionic 7.4.4 and below and the problem seems to existing on the ionic 7.5.x and above.
To reproduce the problem please open https://stackblitz.com/edit/angular-jddxdk-dpaft4
Please note that everything works as expected with the ionic 7.4.4 - see https://stackblitz.com/edit/angular-jddxdk-ybyyrw
Expected Behavior
NavController.pop must navigate back to the home page
Steps to Reproduce
See above
Code Reproduction URL
https://stackblitz.com/edit/angular-jddxdk-dpaft4
Ionic Info
Additional Information
The problem has been discovered after upgrading to the latest ionic framework 7.5.2. Everything worked fine before the upgrade.
Another notes are:
The text was updated successfully, but these errors were encountered: