path: 'dashboard',
component: DashboardComponent,
canActivate: [AuthGuard],
resolve: {
userData: UserDataResolver
},
children: [
{
path: 'manage-users',
component: ManageUsersComponent,
canActivate: [ManageUsersGuard],
},
This is my route, the parent route is dashboard, all child routes have snapshot.data.userData
because UserDataResolver
gets the data for the user after passing AuthGuard
.
ManageUsersGuard
needs userData
that is resolved by his parent route in order to know whether if you can access that route or not, I don't want to create another API call while I know that I already get that data.
Problem
ManageUsersGuard
is being activated before the resolver of the parent route, why is that and what is the right approach?