ionic-framework: [Ionic V4-beta.12] Bug router-outlet destroyed

Bug Report

Ionic Info

   ionic (Ionic CLI)          : 4.1.2 (C:\Users\ariefolo\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.12
   @angular-devkit/core       : 0.8.3
   @angular-devkit/schematics : 0.8.3
   @angular/cli               : 6.2.3
   @ionic/ng-toolkit          : 1.0.0
   @ionic/schematics-angular  : 1.0.1

Describe the Bug In my app, i navigate between two pages. My first page is a list of stations and my second page display details station. For navigate to details station i use this:

this.router.navigate(['station'], {queryParams: station});

And for go back:

this.location.back();

In my detail page i get the station like this:

let stationObservable = this.route.queryParamMap.pipe(
      switchMap(params => {
        this.station = params["params"];
        console.log("STATION ========> "+this.station.name);
        return this.ginkoService.fetchTempsLieu(this.station.name);
      })
    );
    stationObservable.subscribe((stationAttente) =>{
   
    });

when I navigate several times between the two pages and change stations, sometimes the station does not change while the url has changed. At this moment i can see in the debug console

router-outlet destroyed

Steps to Reproduce Steps to reproduce the behavior:

  1. Navigate between two pages.
  2. Change station
  3. Sometimes the station doesn’t change
  4. Router-outlet destroyed

Additional Context This is my route:

const routes: Routes = [
  { path: '', loadChildren: './tabs/tabs.module#TabsPageModule', canActivate: [AuthGuard] },
  { path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule', canActivate: [AuthGuard] },
  { path: 'station', loadChildren: './pages/station/station.module#StationPageModule', canActivate: [AuthGuard] },
  { path: 'schedule', loadChildren: './pages/schedule/schedule.module#SchedulePageModule', canActivate: [AuthGuard] }
];

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 24 (6 by maintainers)

Most upvoted comments

I think Angular Router in Ionic 4 Beta 12 requires a complete review its very unstable. And navigation is the core of any applications so Angular routing should be very robust.

I also have this issue on v4.0.0-beta.11. It occurs only if I go from the initial module that loads for my app to a different module, and then try to navigate to a route from the initial module.

i.e.

  • App starts and loads Module A, showing Component 1
  • Press a button and be navigated to Module B, showing Component 2
  • Press the back button and come back to Module A Component 1
  • Press a button to be navigated to Module A, Component 3 - but this doesnt work. The URL changes but the screen remains the same.

Occurs in Chrome when running ionic serve, iOS 12 iPhone X simulator, and iPhone 6S iOS 12 real device.

this issue appear if you forgot to close some html tag. for example: ion-header

Any solution for this issue ?

Same issue, very unstable with multiple routers router-outlet destroyed is contant issue if pulling any data from api. If simple page loads static empty no issues.

router outlet destroyed is a problem?

Any update on this ??

Temporary i’m using <router-outlet> instead of <ion-router-outlet>. Don’t know if it would be solution for you .

+1