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
[angular 9] child pages initially added to incorrect container element in Ionic Angular apps #35338
Comments
Hi @liamdebeasi, thanks for reporting this issue. As far as I can see, the dom manipulations are behaving according to what Ionic is doing. |
Thanks for the reply. I am one of the Ionic developers, and we recently released an update that adds Angular 9 support to the framework. If you follow the additional debugging steps in the repos I included you should see that with Angular 9, multiple instances of our components are being created. On Angular 8 this is not happening. From what I can tell, routing in Angular 9 now thinks that a component's parent is Ionic knows that the While this could very well be something we need to fix in Ionic Angular, the only change that has caused this issue was upgrading to Angular 9. Does Angular 9 change the way it determines how to insert elements into the DOM? I looked through the breaking changes, but I could not find anything that would suggest this. Thanks! |
Hi Liam, it could take a while to unpack what's going on here since I'm not familiar with Ionic. The short answer is yes, Angular 9 does have a different internal representation of the dom. Does Ionic frequently do native dom manipulation like what |
No worries, I'll try to debug more and hopefully I can pinpoint a bit more accurately where the source of this change seems to be coming from (probably tomorrow). Other than the code I sent, we typically stay away from messing with the native DOM and try to let Angular do the heavy lifting on that. That particular line was added to accommodate a change in Angular 6.1 regarding restoring scroll positions. I believe at the time Angular used the document body to work with scrolling (which does not work if you have nested scroll containers). Regarding |
Hey Liam, I think the issue is almost certainly that native DOM manipulation. If you notice, in v9 the |
Ahh okay yep that makes sense. I agree the v9 way is much more consistent 👍. Is this new behavior considered a breaking change? |
Yes, this is related to the last bullet point in the breaking changes:
It has to do with the indexes of the |
Ok thanks for all the help! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The issue is caused by package @angular/routingIs this a regression?
Yes, the previous version in which this bug was not present was: Angular 8.xDescription
We are running into an issue with navigation on Angular 9. It seems that after the upgrade, Angular is inserting pages into the wrong container component.
We have the following DOM layout:
Clicking a button in
app-home
navigates you toapp-child
. In Angular <=8, this child page is added as a child inside ofion-router-outlet
. With Angular 9, this page is initially added as child ofion-app
, and then re-added as a child ofion-router-outlet
. This is causing issues with our users’ apps as certain components no longer work on subsequent navigations to the child page.🔬 Minimal Reproduction
Angular 8 repro: https://github.com/liamdebeasi/ng8-routing-repro
Angular 9 repro: https://github.com/liamdebeasi/ng9-routing-repro
Please see repo README files for steps to reproduce.
🌍 Your Environment
Angular Version:
Anything else relevant?
This is an Ionic Framework v5 application, but we have not changed anything related to our routing setup with regards to Angular 9.
The text was updated successfully, but these errors were encountered: