From 3eee62fa713160e8df143a74eb4108a612ce50c6 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Sat, 10 Sep 2016 16:52:21 -0700 Subject: [PATCH] docs(router): update router configuration docs --- modules/@angular/router/src/config.ts | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/@angular/router/src/config.ts b/modules/@angular/router/src/config.ts index 75e5dc5aa8..12c361b965 100644 --- a/modules/@angular/router/src/config.ts +++ b/modules/@angular/router/src/config.ts @@ -11,9 +11,12 @@ import {Observable} from 'rxjs/Observable'; /** + * @whatItDoes Represents router configuration. + * + * @description * `Routes` is an array of route configurations. Each one has the following properties: * - * - *`path`* is a string that uses the route matcher DSL. + * - `path` is a string that uses the route matcher DSL. * - `pathMatch` is a string that specifies the matching strategy. * - `component` is a component type. * - `redirectTo` is the url fragment which will replace the current matched segment. @@ -104,7 +107,7 @@ import {Observable} from 'rxjs/Observable'; * * ### Empty Path * - * Empty-path route configurations can be used to instantiate components that do not "consume" + * Empty-path route configurations can be used to instantiate components that do not 'consume' * any url segments. Let's look at the following configuration: * * ``` @@ -232,11 +235,32 @@ import {Observable} from 'rxjs/Observable'; * With this configuration in place, navigating to '/parent/10' will create the main child and aux * components. * + * ### Lazy Loading + * + * Lazy loading speeds up our application load time by splitting it into multiple bundles, and + * loading them on demand. The router is designed to make lazy loading simple and easy. Instead of + * providing the children property, you can provide + * the loadChildren property, as follows: + * + * ``` + * [{ + * path: 'team/:id', + * component: Team, + * loadChildren: 'team' + * }] + * ``` + * + * The router will use registered NgModuleFactoryLoader to fetch an NgModule associated with 'team'. + * Then it will + * extract the set of routes defined in that NgModule, and will transparently add those routes to + * the main configuration. + * * @stable use Routes */ export type Routes = Route[]; /** + * @whatItDoes Represents the static data associated with a particular route. * See {@link Routes} for more details. * @stable */ @@ -245,6 +269,7 @@ export type Data = { }; /** + * @whatItDoes Represents the resolved data associated with a particular route. * See {@link Routes} for more details. * @stable */ @@ -253,11 +278,16 @@ export type ResolveData = { }; /** + * @whatItDoes The type of `loadChildren`. + * See {@link Routes} for more details. * @stable */ export type LoadChildrenCallback = () => Type| Promise>| Observable>; /** + * @whatItDoes The type of `loadChildren`. + * + * See {@link Routes} for more details. * @stable */ export type LoadChildren = string | LoadChildrenCallback;