You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Ionic v4] Multiple ion-router-outlets not working #15370
Describe the Bug
Navigation is stuck after navigating between two components with child routes and ion-router-outlets. This works in angular with router-outlet but not after IonicModule is imported.
Steps to Reproduce
Steps to reproduce the behavior:
Same issue here, another thing while we are on a route in child router outlet and use this.routerOutlet.pop(); to go back and then want to visit same child component 2nd time this doesn't work.
It doesn't matter if I'm lazy loading the page or not
I've also tried to wrap the tab pages in an extra ion-router-outlet, but the problem persists.
I've tried removing all other outlets from the ion-tabs and removing all references to the outlet name, but this doesn't solve the problem either.
When I remove my tabs and just use a (nested) ion-router-outlet, the problem persists. I.e. the problem is not with the tabs per se.
Hope this helps!
Update:
I started with the blank starter and added a second page 'Test'. If I navigate from Home to Test, it works with a nice animation. If I navigate back from Test to Home, it works with the proper reverse animation. When I try to navigate from there to Test again, nothing happens. So in conclusion: this doesn't seem to have anything to do with tabs or nested router outlets, but seems to be a core problem. See below for my package info:
@mhartington I don't think it's a duplicate. Like I said in my comment above the problem is not with Tabs per se, and after a little more digging I find it's still a problem when I don't lazy load anything.
Seems like a few things, but mostly coming down to needing to specify a name for the multiple router-outlets. other wise, there's no logic in place to say what outlet should be active.
i found a temporal hacky workaround till they fix it, since named outlets breaks lazy load, and the no-named outlets breaks with components with childs, doing a 'copy' of the directive , will make that the views can difference between 1 outlet and the other one,
i got a full lazy loaded app with 3 levels of tabs finally working without any problem.
The tabs component just use ion-toolbar and ion-buttons, to make the tabs (now im going to try,if it works with the standard ion-tabs component )
bn8-router-outlet is a copy of the ion-router-outlet directive (in my case i removed, the navCrtl and stack stuff, since im not going to use it)
@idanzapp well it doesn't work for me. I tried to clone the directive (plus idk why it's a directive if it's used as a component) and i also imported all the stuff ('cause i needed stack etc.) but it errors with a TypeError: containerEl.commit
@idanzapp actually I refactored my application in order to not use multiple nested ion-router-outlet and... the same problem occurs... now I don't even have anymore "router-outlet destroyed" logged in the console... this is weird as f***.
I'm going to create a well documented issue with an example video on this repo that groups all the outlet related issues too like 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.
Activity
abennouna commentedon Aug 29, 2018
Your Ionic Info says "@ionic/angular 4.0.0-beta.0" have you tried with the updated beta?
naveedahmed1 commentedon Aug 30, 2018
Same issue here, another thing while we are on a route in child router outlet and use this.routerOutlet.pop(); to go back and then want to visit same child component 2nd time this doesn't work.
jurgen-reconcept commentedon Sep 5, 2018
I'm encountering the same issue on beta.7.
Hope this helps!
Update:
I started with the blank starter and added a second page 'Test'. If I navigate from Home to Test, it works with a nice animation. If I navigate back from Test to Home, it works with the proper reverse animation. When I try to navigate from there to Test again, nothing happens. So in conclusion: this doesn't seem to have anything to do with tabs or nested router outlets, but seems to be a core problem. See below for my package info:
jurgen-reconcept commentedon Sep 5, 2018
These issues seem to be the same:
There are also some open issues about a nav back button bug, may also be the same.
mhartington commentedon Sep 12, 2018
Closing as duplicate of #14566
Please track that issue instead of opening new issues.
jurgen-reconcept commentedon Sep 13, 2018
@mhartington I don't think it's a duplicate. Like I said in my comment above the problem is not with Tabs per se, and after a little more digging I find it's still a problem when I don't lazy load anything.
joostvandoremalen commentedon Sep 13, 2018
@jurgen-reconcept @mhartington Might it be due to relative routing as reported here: #15449 ?
mhartington commentedon Sep 13, 2018
Seems like a few things, but mostly coming down to needing to specify a name for the multiple router-outlets. other wise, there's no logic in place to say what outlet should be active.
https://github.com/mhartington/bug-ion-router-outlet
This has the fixed setup. Let me know if that solves your issues @jurgen-reconcept
jurgen-reconcept commentedon Sep 13, 2018
@doender i can confirm that uses absolute paths fixes it for me, but it's definitely less than ideal.
@mhartington your repo seems empty
mhartington commentedon Sep 13, 2018
😄 Silly me, forgot to push. Refresh
25 remaining items
idanzapp commentedon Oct 8, 2018
i found a temporal hacky workaround till they fix it, since named outlets breaks lazy load, and the no-named outlets breaks with components with childs, doing a 'copy' of the directive , will make that the views can difference between 1 outlet and the other one,
i got a full lazy loaded app with 3 levels of tabs finally working without any problem.
The tabs component just use ion-toolbar and ion-buttons, to make the tabs (now im going to try,if it works with the standard ion-tabs component )
bn8-router-outlet is a copy of the ion-router-outlet directive (in my case i removed, the navCrtl and stack stuff, since im not going to use it)
navigator.html =>
Ps. Probably just using "<router-outlet>" instead the 'new directive', will do the trick aswell
giacomocerquone commentedon Oct 12, 2018
@idanzapp well it doesn't work for me. I tried to clone the directive (plus idk why it's a directive if it's used as a component) and i also imported all the stuff ('cause i needed stack etc.) but it errors with a
TypeError: containerEl.commitidanzapp commentedon Oct 13, 2018
try to use <router-outlet> in the 1st level instead the copied directive, and <ion-router-outlet> in the nested ones
giacomocerquone commentedon Oct 15, 2018
@idanzapp actually I refactored my application in order to not use multiple nested ion-router-outlet and... the same problem occurs... now I don't even have anymore "router-outlet destroyed" logged in the console... this is weird as f***.
I'm going to create a well documented issue with an example video on this repo that groups all the outlet related issues too like this.
RHinderiks commentedon Nov 13, 2018
Do named router outlets as of angular 7 support lazy loading ? Or is this something that needs to be fixed by ionic ?
manucorporat commentedon Dec 8, 2018
Will be fixed by #16637
giacomocerquone commentedon Dec 8, 2018
@manucorporat sorry to bother, but part of this issue is involved in this other issue #15959
Means that the other one is solved too?
ionitron-bot commentedon Jan 7, 2019
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.