Debug Navigation / Examine View Stack

Hello there!

Using ionic v6 along with Angular here and want to debug navigation/routing.

I’m using the NavController a lot for routing, but somehow the pop() method is not working as expected in combination with cross-tab routing. E.g. if I forward to a sub-page of Tab-B from Tab-A, then pop() doesn’t return to Tab-A but remains on the sub-page.

However, to resolve such issues in general I would like to be able to debug navigation actions.
Is there any way to examine the view stack?

(I noticed in v3 there was the possibility to call getViews() on navController, which seems to be gone in v6)

Thanks in advance, your support is appreciated.

It’s worth noting that NavController is a wrapper around IonRouterOutlet which in turn uses Angular’s URL router. So there’s a bit of a balancing act here, as we need to work with a browser navigation API.

Do you have a demo app people could look at? It might not be possible to do this, but need to dive into this more

Thanks for your quick reply.
I created a demo app to reproduce the behaviour here.

Not working as expected:

  • Navigate to http://localhost:4200/tabs/tab1
  • Click on Button to navigate to tab3 sub page
  • Click on X Button
    • Actual: no navigation happens
    • Expected: navigate back to tab1

Working as expected: