docs(aio): update migrated content from anguar.io
This commit is contained in:

committed by
Pete Bacon Darwin

parent
ff82756415
commit
fd72fad8fd
50
aio/content/examples/router/src/app/app-routing.module.ts
Normal file
50
aio/content/examples/router/src/app/app-routing.module.ts
Normal file
@ -0,0 +1,50 @@
|
||||
// #docplaster
|
||||
// #docregion, preload-v1
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { ComposeMessageComponent } from './compose-message.component';
|
||||
import { PageNotFoundComponent } from './not-found.component';
|
||||
|
||||
import { CanDeactivateGuard } from './can-deactivate-guard.service';
|
||||
import { AuthGuard } from './auth-guard.service';
|
||||
import { SelectivePreloadingStrategy } from './selective-preloading-strategy';
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{
|
||||
path: 'compose',
|
||||
component: ComposeMessageComponent,
|
||||
outlet: 'popup'
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
loadChildren: 'app/admin/admin.module#AdminModule',
|
||||
canLoad: [AuthGuard]
|
||||
},
|
||||
// #docregion preload-v2
|
||||
{
|
||||
path: 'crisis-center',
|
||||
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
|
||||
data: { preload: true }
|
||||
},
|
||||
// #enddocregion preload-v2
|
||||
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
|
||||
{ path: '**', component: PageNotFoundComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(
|
||||
appRoutes,
|
||||
{ preloadingStrategy: SelectivePreloadingStrategy }
|
||||
)
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
CanDeactivateGuard,
|
||||
SelectivePreloadingStrategy
|
||||
]
|
||||
})
|
||||
export class AppRoutingModule { }
|
Reference in New Issue
Block a user