question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Navigation stops working for nested ion-router-outlet

See original GitHub issue

Bug Report

Ionic version: [x] 4.3.1

Current behaviour:

Using child-routes stops working using nested ion-router-outlets. Issues that could be related: #17638, #17825.

1st

If links and ion-router-outlet are placed inside ion-content links are not clickable.

<!-- No interaction possible -->
<ion-content>
  <a routerLink="app-one">App One</a>
  <a routerLink="app-two">App Two</a>
  <ion-router-outlet></ion-router-outlet>
</ion-content>

If links are placed outside ion-content they are clickable.

<!-- Interaction possible -->
<a routerLink="app-one">App One</a>
<a routerLink="app-two">App Two</a>

<ion-content>
  <ion-router-outlet></ion-router-outlet>
</ion-content>

2nd

Only the first navigation to a child route works. After this, the view is not updated anymore.

navigation-stops-working gif sb-3cdeef4e-ewqEiw

Expected behaviour:

  • A click on a link should navigate to the corresponding component configured in the routing module.

Steps to reproduce:

  • git clone https://github.com/GregOnNet/ionic-4-jest-setup.git
  • cd ionic-4-jest-setup.git
  • git checkout routing
  • npm install
  • ionic serve
  • Visit http://localhost:8100/tabs/tab2
  • Click on App One
  • Click on App Two
  • Note that navigation stops working

Related code:

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/Users/gregor/.config/yarn/global/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.3.1
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

System:

   NodeJS : v10.15.3 (/Users/gregor/.nvm/versions/node/v10.15.3/bin/node)
   npm    : 6.4.1
   OS     : macOS Mojave

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gelliott181commented, Jul 12, 2019

+1 After dealing with multiple issues using ion-router-outlet across multiple releases we have decided to strip all use of the ionic router outlet in favor of the default angular outlet.

This came with some minor styling adjustment for the ion-app and loaded page components, but compared to the issues we faced using the outlet (ActivatedRoutes not having observable properties, lifecycle hooks not properly firing, nested views not navigating) it was a no brainer. The loss of cached pages is regrettable, but it also negated one of our most frequent sources of bugs.

1reaction
ThomasOliver545commented, Jul 10, 2019

+1 Issue also occurs in our project

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Navigation stops working for nested ion-router-outlet
Bug Report. Ionic version: [x] 4.3.1. Current behaviour: Using child-routes stops working using nested ion-router-outlet s. Issues that could be related: ...
Read more >
Problem with IonTabs on a nested route - Ionic React
So… I had a project that was working fine with tabs in a nested route. Recently, it started behaving erratically, a tab would...
Read more >
When using nested children routes in ionic4, the routes stop ...
I leave the main ion-router-outlet in tact, and can navigate between top-level pages without any problems. Inside those top level pages, ...
Read more >
Can anyone help me fix this - If I'm going to a nested route ...
Having multiple nested ion-router-outlets is not supported and probably wont be as the navigation logic there becomes too much to manage.
Read more >
The Art of Nested Router Outlets in Angular - Dev Genius
How to implement nested routing in angular. ... This should work, right? ... If parent path is not having a component assigned, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found