Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 420b9ca

Browse files
brandonrobertswardbell
authored andcommitted
docs(router): Fixed lazy loading initial example
closes #2070
1 parent 162b177 commit 420b9ca

File tree

4 files changed

+49
-13
lines changed

4 files changed

+49
-13
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// #docregion
2+
// #docregion import-router
3+
import { Routes, RouterModule } from '@angular/router';
4+
// #enddocregion import-router
5+
6+
import { loginRoutes,
7+
authProviders } from './login.routing';
8+
9+
import { CanDeactivateGuard } from './can-deactivate-guard.service';
10+
11+
// #docregion lazy-load-crisis-center
12+
const crisisCenterRoutes: Routes = [
13+
{
14+
path: '',
15+
redirectTo: '/crisis-center',
16+
pathMatch: 'full'
17+
},
18+
{
19+
path: 'crisis-center',
20+
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule'
21+
}
22+
];
23+
24+
const appRoutes: Routes = [
25+
...loginRoutes,
26+
...crisisCenterRoutes
27+
];
28+
// #enddocregion lazy-load-crisis-center
29+
30+
export const appRoutingProviders: any[] = [
31+
authProviders,
32+
CanDeactivateGuard
33+
];
34+
35+
export const routing = RouterModule.forRoot(appRoutes);
36+
// #enddocregion
37+
38+
/* A link parameters array
39+
// #docregion heroes-redirect
40+
{
41+
path: '',
42+
redirectTo: '/heroes',
43+
pathMatch: 'full'
44+
},
45+
// #enddocregion heroes-redirect
46+
*/

public/docs/_examples/router/ts/app/app.routing.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,3 @@ export const appRoutingProviders: any[] = [
3333
];
3434

3535
export const routing = RouterModule.forRoot(appRoutes);
36-
37-
/* A link parameters array
38-
// #docregion heroes-redirect
39-
{
40-
path: '',
41-
redirectTo: '/heroes',
42-
pathMatch: 'full'
43-
},
44-
// #enddocregion heroes-redirect
45-
*/

public/docs/_examples/router/ts/plnkr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files":[
44
"!**/*.d.ts",
55
"!**/*.js",
6-
"!**/*.[1,2,3,4,5].*",
6+
"!**/*.[1,2,3,4,5,6].*",
77
"!app/crisis-list.component.ts",
88
"!app/hero-list.component.ts",
99
"!app/crisis-center/add-crisis.component.ts",

public/docs/ts/latest/guide/router.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ figure.image-display
16871687
our child routes.
16881688

16891689
+makeTabs(
1690-
`router/ts/app/app.routing.ts,
1690+
`router/ts/app/app.routing.6.ts,
16911691
router/ts/app/crisis-center/crisis-center.routing.ts`,
16921692
'lazy-load-crisis-center,lazy-load-crisis-center',
16931693
`app.routing.ts (load children),
@@ -1725,7 +1725,7 @@ figure.image-display
17251725
If our initial redirect went to `/heroes` instead of going to `/crisis-center`, the `CrisisCenterModule` would not be loaded until the user
17261726
visited a `Crisis Center` route. We'll update our redirect in our `app.routing.ts` to make this change.
17271727

1728-
+makeExample('router/ts/app/app.routing.ts', 'heroes-redirect', 'app.routing.ts (heroes redirect)')
1728+
+makeExample('router/ts/app/app.routing.6.ts', 'heroes-redirect', 'app.routing.ts (heroes redirect)')
17291729

17301730
<a id="final-app"></a>
17311731
.l-main-section

0 commit comments

Comments
 (0)