Need Two routing stack @angular/routing

🚀 feature request

Relevant Package

This feature request is for @angular/router

Description

While working on angular project i am force to add AuthGuard in every Route
like bellow

const appRoutes: Routes = [
{ path: ‘crisis-center’,
component: CrisisListComponent,
canActivate: [AuthGuard], },
{
path: ‘heroes’,
canActivate: [AuthGuard],
component: HeroListComponent,
},
{ path: ”,
redirectTo: ‘/heroes’,
canActivate: [AuthGuard],
pathMatch: ‘full’
},
{ path: ‘**’, component: PageNotFoundComponent }
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})

Describe the solution you’d like

i am tried to doing this it will better if we can add stack like
One stack which need permission
Other stack which don’t need permission

following is code for just concept
const checkPermission: Routes = [
{ path: ‘demo1’,
component: Component
},
{
path: ‘demo2’,
component: Component,
},
{ path: ”,
redirectTo: ‘/demo3’,
pathMatch: ‘full’
},
];

const normalRoute: Routes = [
{
path: ‘demo4’,
component: Component
},
{
path: ‘demo5’,
component: Component
},
{ path: ‘**’, component: PageNotFoundComponent }
];
@NgModule({
imports: [RouterModule.forRoot(normalRoute, checkPermission)],
exports: [RouterModule]
})

1 possible answer(s) on “Need Two routing stack @angular/routing

  1. Hello, we reviewed this issue and determined that it doesn’t fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular.

    If you are wondering why we don’t resolve support issues via the issue tracker, please check out this explanation.