diff --git a/public/docs/_examples/router/ts/app/app.routing.6.ts b/public/docs/_examples/router/ts/app/app.routing.6.ts new file mode 100644 index 0000000000..33465b837b --- /dev/null +++ b/public/docs/_examples/router/ts/app/app.routing.6.ts @@ -0,0 +1,46 @@ +// #docregion +// #docregion import-router +import { Routes, RouterModule } from '@angular/router'; +// #enddocregion import-router + +import { loginRoutes, + authProviders } from './login.routing'; + +import { CanDeactivateGuard } from './can-deactivate-guard.service'; + +// #docregion lazy-load-crisis-center +const crisisCenterRoutes: Routes = [ + { + path: '', + redirectTo: '/crisis-center', + pathMatch: 'full' + }, + { + path: 'crisis-center', + loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule' + } +]; + +const appRoutes: Routes = [ + ...loginRoutes, + ...crisisCenterRoutes +]; +// #enddocregion lazy-load-crisis-center + +export const appRoutingProviders: any[] = [ + authProviders, + CanDeactivateGuard +]; + +export const routing = RouterModule.forRoot(appRoutes); +// #enddocregion + +/* A link parameters array +// #docregion heroes-redirect +{ + path: '', + redirectTo: '/heroes', + pathMatch: 'full' +}, +// #enddocregion heroes-redirect +*/ diff --git a/public/docs/_examples/router/ts/app/app.routing.ts b/public/docs/_examples/router/ts/app/app.routing.ts index 46f497e45e..1e320cffea 100644 --- a/public/docs/_examples/router/ts/app/app.routing.ts +++ b/public/docs/_examples/router/ts/app/app.routing.ts @@ -33,13 +33,3 @@ export const appRoutingProviders: any[] = [ ]; export const routing = RouterModule.forRoot(appRoutes); - -/* A link parameters array -// #docregion heroes-redirect -{ - path: '', - redirectTo: '/heroes', - pathMatch: 'full' -}, -// #enddocregion heroes-redirect -*/ diff --git a/public/docs/_examples/router/ts/plnkr.json b/public/docs/_examples/router/ts/plnkr.json index 97c725fd7d..83b1913f0e 100644 --- a/public/docs/_examples/router/ts/plnkr.json +++ b/public/docs/_examples/router/ts/plnkr.json @@ -3,7 +3,7 @@ "files":[ "!**/*.d.ts", "!**/*.js", - "!**/*.[1,2,3,4,5].*", + "!**/*.[1,2,3,4,5,6].*", "!app/crisis-list.component.ts", "!app/hero-list.component.ts", "!app/crisis-center/add-crisis.component.ts", diff --git a/public/docs/ts/latest/guide/router.jade b/public/docs/ts/latest/guide/router.jade index 9e5c5372af..60979b8469 100644 --- a/public/docs/ts/latest/guide/router.jade +++ b/public/docs/ts/latest/guide/router.jade @@ -1687,7 +1687,7 @@ figure.image-display our child routes. +makeTabs( - `router/ts/app/app.routing.ts, + `router/ts/app/app.routing.6.ts, router/ts/app/crisis-center/crisis-center.routing.ts`, 'lazy-load-crisis-center,lazy-load-crisis-center', `app.routing.ts (load children), @@ -1725,7 +1725,7 @@ figure.image-display If our initial redirect went to `/heroes` instead of going to `/crisis-center`, the `CrisisCenterModule` would not be loaded until the user visited a `Crisis Center` route. We'll update our redirect in our `app.routing.ts` to make this change. -+makeExample('router/ts/app/app.routing.ts', 'heroes-redirect', 'app.routing.ts (heroes redirect)') ++makeExample('router/ts/app/app.routing.6.ts', 'heroes-redirect', 'app.routing.ts (heroes redirect)') .l-main-section