refactor(router): use ApplicationRef to provide the first bootstrapped component as ROUTER_PRIMARY_COMPONENT automatically.
This removes the routerBindings function as it is no longer necessary. ROUTER_BINDINGS will automatically pick the first bootstrapped component to satisfy ROUTER_PRIMARY_COMPONENT. BREAKING CHANGE: Before: bootstrap(MyComponent, [routerBindings(myComponent)]); After: bootstrap(MyComponent, [ROUTER_BINDINGS]); Closes #4643
This commit is contained in:
@ -18,7 +18,7 @@ import {EventListener, History, Location} from 'angular2/src/core/facade/browser
|
||||
* import {Component, View} from 'angular2/angular2';
|
||||
* import {
|
||||
* ROUTER_DIRECTIVES,
|
||||
* routerBindings,
|
||||
* ROUTER_BINDINGS,
|
||||
* RouteConfig,
|
||||
* Location
|
||||
* } from 'angular2/router';
|
||||
@ -34,9 +34,7 @@ import {EventListener, History, Location} from 'angular2/src/core/facade/browser
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* routerBindings(AppCmp)
|
||||
* ]);
|
||||
* bootstrap(AppCmp, [ROUTER_BINDINGS]);
|
||||
* ```
|
||||
*/
|
||||
@Injectable()
|
||||
|
@ -16,7 +16,7 @@ import {Url} from './url_parser';
|
||||
*
|
||||
* ```
|
||||
* import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
* import {Router, ROUTER_DIRECTIVES, routerBindings, RouteConfig} from 'angular2/router';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_BINDINGS, RouteConfig} from 'angular2/router';
|
||||
*
|
||||
* @Component({...})
|
||||
* @View({directives: [ROUTER_DIRECTIVES]})
|
||||
@ -34,7 +34,7 @@ import {Url} from './url_parser';
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, routerBindings(AppCmp));
|
||||
* bootstrap(AppCmp, ROUTER_BINDINGS);
|
||||
* ```
|
||||
*/
|
||||
export class RouteParams {
|
||||
@ -54,7 +54,7 @@ export class RouteParams {
|
||||
*
|
||||
* ```
|
||||
* import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
* import {Router, ROUTER_DIRECTIVES, routerBindings, RouteConfig} from 'angular2/router';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_BINDINGS, RouteConfig} from 'angular2/router';
|
||||
*
|
||||
* @Component({...})
|
||||
* @View({directives: [ROUTER_DIRECTIVES]})
|
||||
@ -68,7 +68,7 @@ export class RouteParams {
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, routerBindings(AppCmp));
|
||||
* bootstrap(AppCmp, ROUTER_BINDINGS);
|
||||
* ```
|
||||
*/
|
||||
export class Instruction {
|
||||
|
@ -17,7 +17,7 @@ import {OpaqueToken, Injectable, Optional, Inject} from 'angular2/src/core/di';
|
||||
*
|
||||
* ```
|
||||
* import {Component, View} from 'angular2/angular2';
|
||||
* import {ROUTER_DIRECTIVES, routerBindings, RouteConfig} from 'angular2/router';
|
||||
* import {ROUTER_DIRECTIVES, ROUTER_BINDINGS, RouteConfig} from 'angular2/router';
|
||||
*
|
||||
* @Component({...})
|
||||
* @View({directives: [ROUTER_DIRECTIVES]})
|
||||
@ -29,7 +29,7 @@ import {OpaqueToken, Injectable, Optional, Inject} from 'angular2/src/core/di';
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* routerBindings(AppCmp),
|
||||
* ROUTER_BINDINGS,
|
||||
* PathLocationStrategy,
|
||||
* bind(APP_BASE_HREF).toValue('/my/app')
|
||||
* ]);
|
||||
@ -59,7 +59,7 @@ export const APP_BASE_HREF: OpaqueToken = CONST_EXPR(new OpaqueToken('appBaseHre
|
||||
* import {Component, View} from 'angular2/angular2';
|
||||
* import {
|
||||
* ROUTER_DIRECTIVES,
|
||||
* routerBindings,
|
||||
* ROUTER_BINDINGS,
|
||||
* RouteConfig,
|
||||
* Location
|
||||
* } from 'angular2/router';
|
||||
@ -75,7 +75,7 @@ export const APP_BASE_HREF: OpaqueToken = CONST_EXPR(new OpaqueToken('appBaseHre
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, [routerBindings(AppCmp)]);
|
||||
* bootstrap(AppCmp, [ROUTER_BINDINGS]);
|
||||
* ```
|
||||
*/
|
||||
@Injectable()
|
||||
|
@ -10,7 +10,7 @@ import {LocationStrategy} from './location_strategy';
|
||||
* browser's URL.
|
||||
*
|
||||
* `PathLocationStrategy` is the default binding for {@link LocationStrategy}
|
||||
* provided in {@link routerBindings} and {@link ROUTER_BINDINGS}.
|
||||
* provided in {@link ROUTER_BINDINGS}.
|
||||
*
|
||||
* If you're using `PathLocationStrategy`, you must provide a binding for
|
||||
* {@link APP_BASE_HREF} to a string representing the URL prefix that should
|
||||
@ -27,7 +27,7 @@ import {LocationStrategy} from './location_strategy';
|
||||
* import {
|
||||
* APP_BASE_HREF
|
||||
* ROUTER_DIRECTIVES,
|
||||
* routerBindings,
|
||||
* ROUTER_BINDINGS,
|
||||
* RouteConfig,
|
||||
* Location
|
||||
* } from 'angular2/router';
|
||||
@ -44,7 +44,7 @@ import {LocationStrategy} from './location_strategy';
|
||||
* }
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* routerBindings(AppCmp), // includes binding to PathLocationStrategy
|
||||
* ROUTER_BINDINGS, // includes binding to PathLocationStrategy
|
||||
* bind(APP_BASE_HREF).toValue('/my/app')
|
||||
* ]);
|
||||
* ```
|
||||
|
Reference in New Issue
Block a user