docs(router): update router configuration docs
This commit is contained in:
parent
617475005f
commit
3eee62fa71
|
@ -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:
|
* `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.
|
* - `pathMatch` is a string that specifies the matching strategy.
|
||||||
* - `component` is a component type.
|
* - `component` is a component type.
|
||||||
* - `redirectTo` is the url fragment which will replace the current matched segment.
|
* - `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
|
||||||
*
|
*
|
||||||
* 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:
|
* 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
|
* With this configuration in place, navigating to '/parent/10' will create the main child and aux
|
||||||
* components.
|
* 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
|
* @stable use Routes
|
||||||
*/
|
*/
|
||||||
export type Routes = Route[];
|
export type Routes = Route[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @whatItDoes Represents the static data associated with a particular route.
|
||||||
* See {@link Routes} for more details.
|
* See {@link Routes} for more details.
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
|
@ -245,6 +269,7 @@ export type Data = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @whatItDoes Represents the resolved data associated with a particular route.
|
||||||
* See {@link Routes} for more details.
|
* See {@link Routes} for more details.
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
|
@ -253,11 +278,16 @@ export type ResolveData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @whatItDoes The type of `loadChildren`.
|
||||||
|
* See {@link Routes} for more details.
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export type LoadChildrenCallback = () => Type<any>| Promise<Type<any>>| Observable<Type<any>>;
|
export type LoadChildrenCallback = () => Type<any>| Promise<Type<any>>| Observable<Type<any>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @whatItDoes The type of `loadChildren`.
|
||||||
|
*
|
||||||
|
* See {@link Routes} for more details.
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export type LoadChildren = string | LoadChildrenCallback;
|
export type LoadChildren = string | LoadChildrenCallback;
|
||||||
|
|
Loading…
Reference in New Issue