49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
// #docplaster
|
|
// #docregion, preload-v1
|
|
import { NgModule } from '@angular/core';
|
|
import { RouterModule, Routes } from '@angular/router';
|
|
|
|
import { ComposeMessageComponent } from './compose-message/compose-message.component';
|
|
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
|
|
|
|
import { AuthGuard } from './auth/auth.guard';
|
|
import { SelectivePreloadingStrategyService } from './selective-preloading-strategy.service';
|
|
|
|
const appRoutes: Routes = [
|
|
{
|
|
path: 'compose',
|
|
component: ComposeMessageComponent,
|
|
outlet: 'popup'
|
|
},
|
|
{
|
|
path: 'admin',
|
|
loadChildren: './admin/admin.module#AdminModule',
|
|
canLoad: [AuthGuard]
|
|
},
|
|
// #docregion preload-v2
|
|
{
|
|
path: 'crisis-center',
|
|
loadChildren: './crisis-center/crisis-center.module#CrisisCenterModule',
|
|
data: { preload: true }
|
|
},
|
|
// #enddocregion preload-v2
|
|
{ path: '', redirectTo: '/superheroes', pathMatch: 'full' },
|
|
{ path: '**', component: PageNotFoundComponent }
|
|
];
|
|
|
|
@NgModule({
|
|
imports: [
|
|
RouterModule.forRoot(
|
|
appRoutes,
|
|
{
|
|
enableTracing: false, // <-- debugging purposes only
|
|
preloadingStrategy: SelectivePreloadingStrategyService,
|
|
}
|
|
)
|
|
],
|
|
exports: [
|
|
RouterModule
|
|
]
|
|
})
|
|
export class AppRoutingModule { }
|