如何获得canActivate与RouterModule.forRoot()

时间:2018-08-23 17:42:52

标签: angular angular-ui-router canactivate

这是我在app.module.ts中的代码。 AuthGuard似乎只能在“家庭”路径和“ office-info”路径上工作。我在做什么错了?

    RouterModule.forRoot([
  { path: 'login',  component: LoginComponent},
  { path: 'home',  component: HomeComponent, canActivate: [AuthGuard]},
  { path: 'office-info',  component: OfficeInfoComponent, canActivate: [AuthGuard]},
  { path: 'prs',  component: PrsComponent, canActivate: [AuthGuard]},
  { path: 'crs',  component: CrsComponent, canActivate: [AuthGuard]},
  { path: 'conf',  component: ConfBookingListComponent, canActivate: [AuthGuard]},
  { path: 'afe',  component: AfeListComponent, canActivate: [AuthGuard]},
  { path: 'gfocert',  component: GfoCertifyListComponent, canActivate: [AuthGuard]},
  { path: 'gfointk',  component: GfoIntakeListComponent, canActivate: [AuthGuard]},
  { path: 'wte',  component: WteComponent, canActivate: [AuthGuard]},
  { path: 'gysearch',  component: GYSearchComponent, canActivate: [AuthGuard]},
  { path: '', redirectTo: 'home', pathMatch: 'full', canActivate: [AuthGuard]},
  { path: '**', redirectTo: 'home', pathMatch: 'full', canActivate: [AuthGuard]}
])

0 个答案:

没有答案