Skip to content
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

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

Open
GregOnNet opened this issue May 3, 2019 · 9 comments
Open

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

GregOnNet opened this issue May 3, 2019 · 9 comments
Assignees
Labels
package: angular @ionic/angular package type: bug a confirmed bug report

Comments

@GregOnNet
Copy link

GregOnNet commented May 3, 2019

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
@ionitron-bot ionitron-bot bot added the triage label May 3, 2019
@GregOnNet GregOnNet changed the title bug: Navigation stops working for child routes bug: Navigation stops working for nested ion-router-outlet May 6, 2019
@Syleron
Copy link

Syleron commented May 12, 2019

any progress with this?

This is a blocking bug to my project

@REPTILEHAUS
Copy link

Hitting similar issue +1

@liamdebeasi liamdebeasi added package: angular @ionic/angular package type: bug a confirmed bug report labels May 29, 2019
@ionitron-bot ionitron-bot bot removed the triage label May 29, 2019
@almothafar
Copy link

Got some annoying issue, nested ion-router-outlet is not working with correct behavior of back button as it only reads the first navigation on the main, not the sub, not sure if this related to this.

@MarcSchmer
Copy link

+1
It is a blocking issue for our project as well.

@ThomasOliver545
Copy link

+1
Issue also occurs in our project

@eight-molecules
Copy link

+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.

@nelson6e65
Copy link
Contributor

I have similar issue. ActivatedRoute is not giving me the parent value (it's always null) when use ion-router-outlet in a child view.

Only using router-outlet I'm able to get this.route.parent (ActivatedRoute), but animations, etc, are lost. 😢

@nelson6e65
Copy link
Contributor

Is there a Ionic alternative for ActivatedRoute?

@youuri
Copy link

youuri commented Oct 25, 2019

This is a major issue. I've stuck more than a week to finally spot the origin of my bugs. So If you have an ionic v4 app with:

  • Lazy Loading components / routes
  • multiples ion-router-outlet in your code

You will probably get some bugs when changing parent routes / menu / side-pane.

How could i know that the problem is related to ion-router-outlet?

I've check with a chrome://inspect to DOM of my app, i could see that during a parent swap navigation the old DOM for the page is stored and hide with z-index: n-1 where n is 101 for the current view.

So i could have dom like this, with first navigation to main page B.

<ion-router-outlet>
  <main-page-a style="z-index: 100"></main-page-a>
  <main-page-b class="can-go-back" style="z-index: 101></main-page-b>
</ion-router-outlet>

If i navigated back to main page A the bug will occurred a do:

<ion-router-outlet>
  <main-page-a style="z-index: 100"></main-page-a>
  <main-page-b style="z-index: 100></main-page-b>
  <main-page-a class="can-go-back" style="z-index: 101></main-page-b>
</ion-router-outlet>

And now the hell begins, cause with side-pane/menu, you will have bugged related to the fact that multiple dom instance are present for them.

workaround: Actually, i only have 2 <ion-router-outlet> so i decide to switch one of them to the original Angular one: <router-outlet>

That's not the best ... but i hope ionic team will fix this shit.

@mhartington mhartington self-assigned this Oct 27, 2019
@ionic-team ionic-team locked and limited conversation to collaborators Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: angular @ionic/angular package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests