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