I have the routes file as below
const routes: Routes = [
{
path: '',
component: DashboardComponent,
canActivate: [DashboardRoleGuard],
children: [{
path: 'admin',
component: AdminDashboardComponent
// canActivateChild: [RedirectGuard]
}, {
path: 'user',
component: UserDashboardComponent
// canActivateChild: [RedirectGuard]
}],
data: {
expectedRole1: ["admin", "SiteAdmin", "OrgAdmin", "SuperAdmin"],
expectedRole2: ["user", "NormalUser"],
redirectTo: "",
isManual: false
}
}]
in data section i have a flag isManual. so i want to change the value of flag. i have tried below code in route guard.
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
// this will be passed from the route config
// on the data property
const expectedRole1 = next.data.expectedRole1;
const expectedRole2 = next.data.expectedRole2;
debugger
console.log(next.data);
if (state.url.indexOf("admin") > -1 || state.url.indexOf("user") > -1) {
next.data["isManual"] = true;
}
But the value is not modifying , any one let me know how to do this one.