2016-10-05 16:59:09 -05:00
|
|
|
// #docplaster
|
2016-10-20 00:02:47 -05:00
|
|
|
// #docregion, preload-v1
|
2016-10-29 16:08:54 -05:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import { RouterModule, Routes } from '@angular/router';
|
2016-10-05 16:59:09 -05:00
|
|
|
|
2016-12-20 17:26:09 -06:00
|
|
|
import { ComposeMessageComponent } from './compose-message.component';
|
|
|
|
import { CanDeactivateGuard } from './can-deactivate-guard.service';
|
|
|
|
import { AuthGuard } from './auth-guard.service';
|
|
|
|
import { PreloadSelectedModules } from './selective-preload-strategy';
|
2016-10-05 16:59:09 -05:00
|
|
|
|
2016-10-29 16:08:54 -05:00
|
|
|
const appRoutes: Routes = [
|
2016-12-20 17:26:09 -06:00
|
|
|
{
|
|
|
|
path: 'compose',
|
|
|
|
component: ComposeMessageComponent,
|
|
|
|
outlet: 'modal'
|
|
|
|
},
|
2016-10-29 16:08:54 -05:00
|
|
|
{
|
|
|
|
path: 'admin',
|
|
|
|
loadChildren: 'app/admin/admin.module#AdminModule',
|
|
|
|
canLoad: [AuthGuard]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '',
|
|
|
|
redirectTo: '/heroes',
|
|
|
|
pathMatch: 'full'
|
|
|
|
},
|
|
|
|
// #docregion preload-v2
|
|
|
|
{
|
|
|
|
path: 'crisis-center',
|
|
|
|
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
|
|
|
|
data: {
|
|
|
|
preload: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// #enddocregion preload-v2
|
|
|
|
];
|
|
|
|
|
2016-10-05 16:59:09 -05:00
|
|
|
@NgModule({
|
|
|
|
imports: [
|
2016-10-29 16:08:54 -05:00
|
|
|
RouterModule.forRoot(
|
|
|
|
appRoutes,
|
|
|
|
{ preloadingStrategy: PreloadSelectedModules }
|
|
|
|
)
|
2016-10-05 16:59:09 -05:00
|
|
|
],
|
|
|
|
exports: [
|
|
|
|
RouterModule
|
|
|
|
],
|
|
|
|
providers: [
|
2016-10-20 00:02:47 -05:00
|
|
|
CanDeactivateGuard,
|
|
|
|
PreloadSelectedModules
|
2016-10-05 16:59:09 -05:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export class AppRoutingModule {}
|