Moved all heroes functionality into milestone 2 Crisis Center initial functionality is milestone 3 Admin feature module as milestone 4 including route guard examples Updated milestone 5 to lazy load admin feature module Added examples for CanLoad, CanActivateChildren guard, component-less routes Added section on explanation of ActivatedRoute Added section on animating route components Added section on relative navigation
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
// #docplaster
|
|
// #docregion
|
|
import { ModuleWithProviders } from '@angular/core';
|
|
import { Routes, 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
|
|
import { AuthGuard } from '../auth-guard.service';
|
|
|
|
// #docregion can-activate-child
|
|
const adminRoutes: Routes = [
|
|
{
|
|
path: 'admin',
|
|
component: AdminComponent,
|
|
canActivate: [AuthGuard],
|
|
children: [
|
|
{
|
|
path: '',
|
|
canActivateChild: [AuthGuard],
|
|
children: [
|
|
{ path: 'crises', component: ManageCrisesComponent },
|
|
{ path: 'heroes', component: ManageHeroesComponent },
|
|
{ path: '', component: AdminDashboardComponent }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
];
|
|
|
|
export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes);
|
|
// #enddocregion
|