Repository navigation
Closed
Labels
Description
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:
- Navigate between two pages.
- Change station
- Sometimes the station doesn't change
- 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] }
];
Reacted by Naveed Ahmed, AndreasGassmann, Omair, Yuri Camara and mxhrtm
Metadata
Metadata
Assignees
Labels
Type
Fields
No fields configured for issues without a type.
Activity
zaarheed commentedon Sep 29, 2018
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.
Occurs in Chrome when running
ionic serve, iOS 12 iPhone X simulator, and iPhone 6S iOS 12 real device.lapachuka commentedon Oct 2, 2018
+1
naveedahmed1 commentedon Oct 3, 2018
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.
Anthony2539 commentedon Oct 13, 2018
Any solution for this issue ?
lapachuka commentedon Oct 13, 2018
Temporary i'm using
<router-outlet>instead of<ion-router-outlet>. Don't know if it would be solution for you .zaarheed commentedon Oct 13, 2018
I temporarily resolved this by creating a StartupModule that is loaded when the app is opened. It shows a loading spinner whilst the user’s location is determined and then it navigates to my original start module.
This resolves the issue for me, but only really works because I need to determine the user’s location anyway. Perhaps as a temporary work-around you could just show the splash screen in the StartupModule for one second before navigating to the original module.
I believe you may also be able to use NavController.navigateRoute() to set the original module as the root screen to avoid the user being able to press back and find themselves back at the StartupModule.
Chethannp commentedon Oct 22, 2018
Any update on this ??
ddsurf123 commentedon Oct 22, 2018
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.
jordanpurinton commentedon Oct 24, 2018
Bump
Franky238 commentedon Nov 16, 2018
this issue appear if you forgot to close some html tag. for example:
ion-header5 remaining items
urbanjoe commentedon Dec 14, 2018
here we go:
https://github.com/sloschi/ionic-angular-routing-test
paulstelzer commentedon Dec 14, 2018
@urbanjoe could you plese tell me what I should look at? I am starting it and it's just a title there - no navigation or something like that

urbanjoe commentedon Dec 14, 2018
ups, just swipe from the right.. there is the menu:

Reproduce:

Please start with objects and click 1,2,3
Then click on Task and u get the render-outlet destroyed and the navigation does not work anymore in that outlet

paulstelzer commentedon Dec 14, 2018
@urbanjoe Alright: Your issue is because of two things:
You are using two ion-split-panes. Here it's normal that one will be destroyed if you leave the page with it (e.g. with the tasks).
You are using href, please always use routerLink and always absolute paths (this you already did)
If you doing step 2, it will work okay. For example I changed it for the object lists and then it's looking good (see gif). And if I leave the page, it's normal that router-outlet destroyed arrives because the objects list with the split-pane will be destroyed and so this log occurs
And here you can see that the navigation works perfect afterwards:

urbanjoe commentedon Dec 14, 2018
@paulstelzer Yes, u are right, the repo has no update to the beta 18 (routerLink) right now, but locally i already updated.
Please try to navigate between taks and object (both are childs), the the destroyed appears. If u go to a root page and then to another child page everything is ok :-/
paulstelzer commentedon Dec 14, 2018
@urbanjoe Ah okay, what you now describe is what I already created as seperate issue -> #16411 (there is also a workaround - hopefully this work for you too)
urbanjoe commentedon Dec 14, 2018
Perfect, i'll give it a shoot
paulstelzer commentedon Dec 14, 2018
@urbanjoe Your issue is the same like #16411 - Could you please comment there?
paulstelzer commentedon Dec 14, 2018
I talked with @manucorporat about this topic. So I summarize it here and will close the issue because of the following:
<ion-router-outlet>inside is destroying<ion-router-outlet>or usingion-tabs. If a component will be destroyed (removed from the dom - ngOnDestroy() also calls) and there is<ion-router-outlet>inside (or ion-tabs), the "router-outlet destroyed" will be displayed in the console<ion-router-outlet>. If you now destroy the parent component, "router-outlet destroyed" will be displayed in the consoleBut also keep in mind:
<ion-router-outlet>and / or more than one<ion-split-pane>inside your code, this can lead to some issues, we are already aware of, e.g. [4.0.0-beta.16] ion-router-outlet issue tabs split-pane navigation broken / stops working #16411 or [Ionic 4.0.0, beta 8] Menu not working with 2 <ion-split-pane>'s #15538<ion-router-outlet>, but as said at the beginning, that is not a bad sign<ion-router-outlet>(and no tabs) and you still get "router outlet destroyed" then you should check your routing if you destroy the ion-router-outlet for some reasons.I hope that I described it in detail so everyone knows what happens. And as I said that you get problems, has not to do with the logs, the root cause is something else :)
And because the root cause is not "router-outlet destroyed", it's better to open a issue for every problem. So if your problem is not #16411 or #15538 or #16736, please make a short search (maybe there is already an issue for) and if not, please create a new issue and include a repo so we can check it!
ionitron-bot commentedon Jan 13, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.