From e21718faa91f1db79dbd9ce5251c5f7fe166c203 Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Sun, 31 Jan 2016 20:34:20 -0600 Subject: [PATCH] docs(router): Updated inconsistencies in router docs Closes #6805 --- modules/angular2/src/router/instruction.ts | 17 +++++++++-------- .../angular2/src/router/location_strategy.ts | 3 +-- .../angular2/src/router/route_config_impl.ts | 15 ++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/modules/angular2/src/router/instruction.ts b/modules/angular2/src/router/instruction.ts index 1c30dcb356..29c6ab7aca 100644 --- a/modules/angular2/src/router/instruction.ts +++ b/modules/angular2/src/router/instruction.ts @@ -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 { diff --git a/modules/angular2/src/router/location_strategy.ts b/modules/angular2/src/router/location_strategy.ts index 42724833a5..7c258e2734 100644 --- a/modules/angular2/src/router/location_strategy.ts +++ b/modules/angular2/src/router/location_strategy.ts @@ -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'}) * ]); * ``` diff --git a/modules/angular2/src/router/route_config_impl.ts b/modules/angular2/src/router/route_config_impl.ts index b52de354df..30be4f704a 100644 --- a/modules/angular2/src/router/route_config_impl.ts +++ b/modules/angular2/src/router/route_config_impl.ts @@ -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 {} * ```