parent
b0f7d59e64
commit
e21718faa9
|
@ -14,11 +14,12 @@ import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
|||
* ```
|
||||
* import {Component} from 'angular2/core';
|
||||
* import {bootstrap} from 'angular2/platform/browser';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteParams} from
|
||||
* 'angular2/router';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
* {path: '/user/:id', component: UserCmp, as: 'UserCmp'},
|
||||
* {path: '/user/:id', component: UserCmp, name: 'UserCmp'},
|
||||
* ])
|
||||
* class AppCmp {}
|
||||
*
|
||||
|
@ -47,14 +48,14 @@ export class RouteParams {
|
|||
* ### Example
|
||||
*
|
||||
* ```
|
||||
* import {Component, View} from 'angular2/core';
|
||||
* import {Component} from 'angular2/core';
|
||||
* import {bootstrap} from 'angular2/platform/browser';
|
||||
* import {Router, ROUTER_DIRECTIVES, routerBindings, RouteConfig} from 'angular2/router';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteData} from
|
||||
* 'angular2/router';
|
||||
*
|
||||
* @Component({...})
|
||||
* @View({directives: [ROUTER_DIRECTIVES]})
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
* {path: '/user/:id', component: UserCmp, as: 'UserCmp', data: {isAdmin: true}},
|
||||
* {path: '/user/:id', component: UserCmp, name: 'UserCmp', data: {isAdmin: true}},
|
||||
* ])
|
||||
* class AppCmp {}
|
||||
*
|
||||
|
@ -67,7 +68,7 @@ export class RouteParams {
|
|||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, routerBindings(AppCmp));
|
||||
* bootstrap(AppCmp, ROUTER_PROVIDERS);
|
||||
* ```
|
||||
*/
|
||||
export class RouteData {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {UrlChangeListener} from './platform_location';
|
|||
/**
|
||||
* `LocationStrategy` is responsible for representing and reading route state
|
||||
* from the browser's URL. Angular provides two strategies:
|
||||
* {@link HashLocationStrategy} (default) and {@link PathLocationStrategy}.
|
||||
* {@link HashLocationStrategy} and {@link PathLocationStrategy} (default).
|
||||
*
|
||||
* This is used under the hood of the {@link Location} service.
|
||||
*
|
||||
|
@ -54,7 +54,6 @@ export abstract class LocationStrategy {
|
|||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* ROUTER_PROVIDERS,
|
||||
* PathLocationStrategy,
|
||||
* provide(APP_BASE_HREF, {useValue: '/my/app'})
|
||||
* ]);
|
||||
* ```
|
||||
|
|
|
@ -26,10 +26,10 @@ export class RouteConfig {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig} from 'angular2/router';
|
||||
* import {RouteConfig, Route} from 'angular2/router';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* {path: '/home', component: HomeCmp, name: 'HomeCmp' }
|
||||
* new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
|
||||
* ])
|
||||
* class MyApp {}
|
||||
* ```
|
||||
|
@ -110,10 +110,11 @@ export class AuxRoute implements RouteDefinition {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig} from 'angular2/router';
|
||||
* import {RouteConfig, AsyncRoute} from 'angular2/router';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* {path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name: 'MyLoadedCmp'}
|
||||
* new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
|
||||
* 'MyLoadedCmp'})
|
||||
* ])
|
||||
* class MyApp {}
|
||||
* ```
|
||||
|
@ -150,11 +151,11 @@ export class AsyncRoute implements RouteDefinition {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig} from 'angular2/router';
|
||||
* import {RouteConfig, Route, Redirect} from 'angular2/router';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* {path: '/', redirectTo: ['/Home'] },
|
||||
* {path: '/home', component: HomeCmp, name: 'Home'}
|
||||
* new Redirect({path: '/', redirectTo: ['/Home'] }),
|
||||
* new Route({path: '/home', component: HomeCmp, name: 'Home'})
|
||||
* ])
|
||||
* class MyApp {}
|
||||
* ```
|
||||
|
|
Loading…
Reference in New Issue