44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
// #docplaster
|
|
// #docregion
|
|
import { NgModule } from '@angular/core';
|
|
import { RouterModule } from '@angular/router';
|
|
|
|
import { AdminComponent } from './admin.component';
|
|
import { AdminDashboardComponent } from './admin-dashboard.component';
|
|
import { ManageCrisesComponent } from './manage-crises.component';
|
|
import { ManageHeroesComponent } from './manage-heroes.component';
|
|
|
|
// #docregion admin-route, can-activate-child
|
|
import { AuthGuard } from '../auth-guard.service';
|
|
|
|
@NgModule({
|
|
imports: [
|
|
RouterModule.forChild([
|
|
{
|
|
path: 'admin',
|
|
component: AdminComponent,
|
|
canActivate: [AuthGuard],
|
|
children: [
|
|
{
|
|
path: '',
|
|
children: [
|
|
{ path: 'crises', component: ManageCrisesComponent },
|
|
{ path: 'heroes', component: ManageHeroesComponent },
|
|
{ path: '', component: AdminDashboardComponent }
|
|
],
|
|
// #enddocregion admin-route
|
|
// #docregion can-activate-child
|
|
canActivateChild: [AuthGuard]
|
|
// #docregion admin-route
|
|
}
|
|
]
|
|
}
|
|
])
|
|
],
|
|
exports: [
|
|
RouterModule
|
|
]
|
|
})
|
|
export class AdminRoutingModule {}
|
|
// #enddocregion
|