I am trying to access params from a child and can't seem to access them. I have my routes organized as follows:
const clientsRoutes: Routes = [
{
path: 'clients',
component: ClientIndexPage,
// loadChildren: "./client-index/client-index.module#ClientIndexPageModule",
canActivate: [AuthGuard],
},
{ path: 'clients/:id',
component: ClientDetailPage,
canActivate: [AuthGuard],
canActivateChild: [AuthGuard],
children: [
{
path: 'profile',
component: ProfilePage
// loadChildren: './client-detail/profile/profile.module#ProfilePageModule',
},
{
path: 'finance',
component: FinancePage
// loadChildren: './client-detail/finance/finance.module#FinancePageModule'
},
{
path: '',
redirectTo: 'profile',
pathMatch: 'full'
}
]
},
];
From ClientDetailPage
I can access the :id
, but when I attempt to grab it from the ProfilePage
, It is inaccessible:
// ClientDetailsPage
console.log(this.route.snapshot.paramMap.get('id)
// returns the correct value
// ProfilePage
console.log(this.route.snapshot.paramMap.get('id))
// returns null
console.log(this.route.parent)
//returns null
Is there something I am missing? It might be worth noting that ClientDetailsPage
and ProfilePage
both have seperate modules.