MOBILE-3905 core: Fix getting snapshot params

main
Noel De Martin 2021-11-04 10:47:03 +01:00
parent f765976247
commit b98be569ea
1 changed files with 6 additions and 4 deletions

View File

@ -264,14 +264,16 @@ export class CoreNavigatorService {
* @return Value of the parameter, undefined if not found. * @return Value of the parameter, undefined if not found.
*/ */
protected getRouteSnapshotParam<T = unknown>(name: string, route?: ActivatedRoute): T | undefined { protected getRouteSnapshotParam<T = unknown>(name: string, route?: ActivatedRoute): T | undefined {
if (!route?.snapshot) { if (!route) {
return; return;
} }
const value = route.snapshot.queryParams[name] ?? route.snapshot.params[name]; if (route.snapshot) {
const value = route.snapshot.queryParams[name] ?? route.snapshot.params[name];
if (value !== undefined) { if (value !== undefined) {
return value; return value;
}
} }
return this.getRouteSnapshotParam(name, route.parent || undefined); return this.getRouteSnapshotParam(name, route.parent || undefined);