Ionic version:
[x] 4.2.0
Current behavior:
ActivatedRoute.parent is null in ion-tabs
Related code:
routes
{
path: ':id',
component: DetailsPage,
children: [
{
path: 'info',
component: DetailsInfoPage
},
...
]
}
DetailsInfoPage
constructor(private config: AppConfig,
private route: ActivatedRoute) {
this.route.parent.params.subscribe(params => {
this.Id = params.id;
});
}
this.route.parent is null in this case whereas it used to have a value in v4.1.2
Having the same problem...any solution ?
Same problem here. I can add that it was working fine on ionic 4.0
same with "@ionic/angular": "^4.5.0"
Solution is to change to "@ionic/angular": "4.0.0"
I'm experiencing this same issue in 4.5.0, but in a different setup with nested ion-router-outlets. My second level outlet has a populated snapshot, but the parent ActivatedRoute is null. This has broken sibling navigation between pages.
Same issue here, it blocks me to manually navigate back to a parent page from a child page, as it always redirect me to the root of my app whatever path I use :
this.router.navigate(['xxx'], { relativeTo: this.route.parent });
Don't know if it's related but I can't do it using the following code either, as it just navigate to the same current page, emptying parameters :
this.router.navigate(['../'], { relativeTo: this.route });
"ionic": "5.2.4"
"@ionic/angular": "4.7.4"
Are there any updates or workarounds?
Are there any updates or workarounds?
You can use activatedRoute.snapshot.parent
This is also an issue for me. Especially if you want to navigate relative to the parent route I don't see a way how to do that.
Are there any updates or workarounds?
You can use
activatedRoute.snapshot.parent
Thanks you saved the day
Hi,
activatedRoute.snapshot.parent doesn't work in my case.
This is the output of ionic info:
ionic info
Ionic:
Ionic CLI : 5.4.13 (/usr/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.7
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.1
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, browser 6.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 7 other plugins)
Utility:
cordova-res (update available: 0.9.0) : 0.8.1
native-run : 0.3.0
System:
NodeJS : v12.13.1 (/usr/bin/node)
npm : 6.12.1
OS : Linux 4.19
I found a workaround using : id = this.activatedRoute.snapshot._urlSegment.segments[3].path; but I don't really like this method...
Another idea ?
I can verify this bug on these versions:
"@angular/animations": "~8.1.2",
"@angular/cdk": "~8.2.3",
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@capacitor/android": "^1.5.0",
"@capacitor/core": "1.5.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/geolocation": "^5.23.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.7.1",
"@ionic/storage": "^2.2.0",
This bug has been reported in april last year. How is this still not even triaged?
Thanks for the issue. Is this still an issue with the latest version of Ionic Framework? If so, please provide a repo with the code required to reproduce this issue.
Thanks for the issue! This issue is being closed due to the lack of a reply. 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.
Thank you for using Ionic!
Most helpful comment
You can use
activatedRoute.snapshot.parent