Skip to content

Commit e21718f

Browse files
docs(router): Updated inconsistencies in router docs
Closes angular#6805
1 parent b0f7d59 commit e21718f

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

modules/angular2/src/router/instruction.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
1414
* ```
1515
* import {Component} from 'angular2/core';
1616
* import {bootstrap} from 'angular2/platform/browser';
17-
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router';
17+
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteParams} from
18+
* 'angular2/router';
1819
*
1920
* @Component({directives: [ROUTER_DIRECTIVES]})
2021
* @RouteConfig([
21-
* {path: '/user/:id', component: UserCmp, as: 'UserCmp'},
22+
* {path: '/user/:id', component: UserCmp, name: 'UserCmp'},
2223
* ])
2324
* class AppCmp {}
2425
*
@@ -47,14 +48,14 @@ export class RouteParams {
4748
* ### Example
4849
*
4950
* ```
50-
* import {Component, View} from 'angular2/core';
51+
* import {Component} from 'angular2/core';
5152
* import {bootstrap} from 'angular2/platform/browser';
52-
* import {Router, ROUTER_DIRECTIVES, routerBindings, RouteConfig} from 'angular2/router';
53+
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteData} from
54+
* 'angular2/router';
5355
*
54-
* @Component({...})
55-
* @View({directives: [ROUTER_DIRECTIVES]})
56+
* @Component({directives: [ROUTER_DIRECTIVES]})
5657
* @RouteConfig([
57-
* {path: '/user/:id', component: UserCmp, as: 'UserCmp', data: {isAdmin: true}},
58+
* {path: '/user/:id', component: UserCmp, name: 'UserCmp', data: {isAdmin: true}},
5859
* ])
5960
* class AppCmp {}
6061
*
@@ -67,7 +68,7 @@ export class RouteParams {
6768
* }
6869
* }
6970
*
70-
* bootstrap(AppCmp, routerBindings(AppCmp));
71+
* bootstrap(AppCmp, ROUTER_PROVIDERS);
7172
* ```
7273
*/
7374
export class RouteData {

modules/angular2/src/router/location_strategy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {UrlChangeListener} from './platform_location';
55
/**
66
* `LocationStrategy` is responsible for representing and reading route state
77
* from the browser's URL. Angular provides two strategies:
8-
* {@link HashLocationStrategy} (default) and {@link PathLocationStrategy}.
8+
* {@link HashLocationStrategy} and {@link PathLocationStrategy} (default).
99
*
1010
* This is used under the hood of the {@link Location} service.
1111
*
@@ -54,7 +54,6 @@ export abstract class LocationStrategy {
5454
*
5555
* bootstrap(AppCmp, [
5656
* ROUTER_PROVIDERS,
57-
* PathLocationStrategy,
5857
* provide(APP_BASE_HREF, {useValue: '/my/app'})
5958
* ]);
6059
* ```

modules/angular2/src/router/route_config_impl.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export class RouteConfig {
2626
*
2727
* ### Example
2828
* ```
29-
* import {RouteConfig} from 'angular2/router';
29+
* import {RouteConfig, Route} from 'angular2/router';
3030
*
3131
* @RouteConfig([
32-
* {path: '/home', component: HomeCmp, name: 'HomeCmp' }
32+
* new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
3333
* ])
3434
* class MyApp {}
3535
* ```
@@ -110,10 +110,11 @@ export class AuxRoute implements RouteDefinition {
110110
*
111111
* ### Example
112112
* ```
113-
* import {RouteConfig} from 'angular2/router';
113+
* import {RouteConfig, AsyncRoute} from 'angular2/router';
114114
*
115115
* @RouteConfig([
116-
* {path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name: 'MyLoadedCmp'}
116+
* new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
117+
* 'MyLoadedCmp'})
117118
* ])
118119
* class MyApp {}
119120
* ```
@@ -150,11 +151,11 @@ export class AsyncRoute implements RouteDefinition {
150151
*
151152
* ### Example
152153
* ```
153-
* import {RouteConfig} from 'angular2/router';
154+
* import {RouteConfig, Route, Redirect} from 'angular2/router';
154155
*
155156
* @RouteConfig([
156-
* {path: '/', redirectTo: ['/Home'] },
157-
* {path: '/home', component: HomeCmp, name: 'Home'}
157+
* new Redirect({path: '/', redirectTo: ['/Home'] }),
158+
* new Route({path: '/home', component: HomeCmp, name: 'Home'})
158159
* ])
159160
* class MyApp {}
160161
* ```

0 commit comments

Comments
 (0)