I know that we can group routes located in one module. For instance:
canActivate: [AuthGuard], children: [ { path: '', children: [ { path: 'crises', component: ManageCrisesComponent }, { path: 'heroes', component: ManageHeroesComponent }, { path: '', component: AdminDashboardComponent } ], }
But I have to add this protector to every module routing file. And I have a lot of them.
I want the user to be unable to go to any route except one (login) if he is not authorized.
What is the correct way to add protection for all of them?
source share