Hello, I need to make a login with 3 different access levels, all levels have access to a specific page, not all.
Level 1: Access to [HomePage, NewsPage]
Leve 2: Access to [ReportNews, AnswerPage] and All page of Level 1
Leve 3: Access to [Config Page] and all page of level2 and leve 1
What i need to do?, Is correct use 3 guards
const routes: Routes = [
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: 'home', loadChildren: './home/home.module#HomePageModule',canActivate:[Level1GuardService] || [ Leve2GuardService] }, //Only check the first
{ path: 'ReportNews', loadChildren: './reportnews/reportnews.module#ReportNewsPageModule',canActivate:[Level2GuardService || Leve3GuardService] }, // Onli check the fist
{ path: 'OtherRute', loadChildren: './otherrute/otherrute.module#OtherRutePageModule',canActivate:[Level2GuardService, Leve3GuardService] }, // If both are true you can access
{ path: 'login', loadChildren: './login/login/login.module#LoginPageModule' },
{ path: 'register', loadChildren: './login/register/register.module#RegisterPageModule' },
];
I’m trying that, but I readed that if I use more than one guard, the guards must be true to can access the view
I don´t understand if the solution is with Gard, somebody could me sugest other idea or explai me, how work with guards with Angular route