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:
Alex Rickabaugh
2015-10-09 16:22:07 -07:00
parent 19c1bd7375
commit 90191ce261
9 changed files with 57 additions and 89 deletions

View File

@ -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')
* ]);
* ```