Problem with routing after switching to Lazy Loading

Hello Everybody,

I could not find anything similar on the net so I’m trying my luck here:

We are building a new Ionic app based on Version 3.9.2 of the framework. Starting out with normal loading pages everything worked just fine. Now we switched to lazy loaded pages. After some initial trouble I got everything working. Except the routing when switching pages:

I get a sporadic error “Uncaught Error: Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment:…” when switching pages, regardless of setting rootPage, popping from the nav-controller or pushing a new page. When looking at the URL in the browser-window then the segment part after the “#” is missing.
Unfortunately, this does not happen every time, it’s completely sporadic. I can switch the page several times and on the fifth, eight, random time the error occurs.
Interessting enough is, that the page actually is displayed correctly when I close the error message and the app behaves normally. Sometimes though, I’m thrown completely back to the first page of the app (the one that is set as root in the app.component.ts file).
Has anyone experienced similar problems?

this appears in browser after you changed some code?

If you go back manually to localhost:8100 and everthing works fine?

Maybe your page given to navController is not available from this state, because it is set from an earlier page etc…I don’t know how so say it better.

For example you use subertabs. The tabs are set at rootpage, You change something on a tabbed page, browser reload tabbed page ,but tabpages not avaiable from this state and you must go back to rootpage to make it available again…

Best regards, anna-liebt

Hello anna-liebt,

Thank you for your reply!

Yes, it seems like the router looses some pages from time to time. But unfortunately this seems to be random. I can for example switch between two pages back and forth, and sometimes the error occurs, sometimes not.

Best regards,



maybe it is worth to try each time, before in browser reloaded, go back to localhost:8100. So you always strt at your rootpage If then these problem exist furtermore you must dig deeper, otherwise I think the browser doesn’t loose pages because at this state the requested page object is null.

best regards, anna-liebt.