* added example of feature module pre-loading * added transition aliases for route animations
45 lines
982 B
TypeScript
45 lines
982 B
TypeScript
// #docplaster
|
|
// #docregion, preload-v1
|
|
import { NgModule } from '@angular/core';
|
|
import {
|
|
RouterModule,
|
|
// #enddocregion preload-v1
|
|
PreloadAllModules
|
|
// #docregion preload-v1
|
|
} from '@angular/router';
|
|
|
|
import { CanDeactivateGuard } from './can-deactivate-guard.service';
|
|
import { AuthGuard } from './auth-guard.service';
|
|
|
|
@NgModule({
|
|
imports: [
|
|
RouterModule.forRoot([
|
|
{
|
|
path: 'admin',
|
|
loadChildren: 'app/admin/admin.module#AdminModule',
|
|
canLoad: [AuthGuard]
|
|
},
|
|
{
|
|
path: '',
|
|
redirectTo: '/heroes',
|
|
pathMatch: 'full'
|
|
},
|
|
{
|
|
path: 'crisis-center',
|
|
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule'
|
|
},
|
|
],
|
|
// #enddocregion preload-v1
|
|
{ preloadingStrategy: PreloadAllModules }
|
|
// #docregion preload-v1
|
|
)
|
|
],
|
|
exports: [
|
|
RouterModule
|
|
],
|
|
providers: [
|
|
CanDeactivateGuard
|
|
]
|
|
})
|
|
export class AppRoutingModule {}
|