我需要在一个键的基础上做角度的条件路由,但我没有得到怎么做 . 任何人都可以建议我的方式:
这是当前的场景:
const appRoutes: Routes = [
//Site routes goes here
{
path: 'index/app',
component: SiteLayoutComponent,
children: [
{ path: 'onboarding', component: ApplicationFormComponent, canActivate: [AuthGuard] },
{ path: 'onboardingEdit/:appID/:flow/:flowId', component: ApplicationFormEditComponent, canActivate: [AuthGuard] },
{ path: 'equipmentdashboard', component: EquipmentDashboardComponent, canActivate: [AuthGuard] }
]
},
// App routes goes here here
{
path: '',
component: AppLayoutComponent,
children: [
{ path: '', component: CarouselComponent, pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'index', component: IndexComponent, canActivate: [AuthGuard] },
//{ path: 'portallogin', component: PoratlLoginComponent },
]
},
];
我需要像org =“xyz”那样对Key进行条件化,然后在下面的路径组件上将是SiteLayoutComponent而不是AppLayoutComponent
{
path: '',
component: SiteLayoutComponent,
children: [
{ path: '', component: CarouselComponent, pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'index', component: IndexComponent, canActivate: [AuthGuard] },
//{ path: 'portallogin', component: PoratlLoginComponent },
]
},
请帮忙 .