2016-02-25 12:04:59 -08:00
|
|
|
import {ROUTER_PROVIDERS_COMMON} from './router_providers_common';
|
2016-01-21 09:58:28 -08:00
|
|
|
import {Provider} from 'angular2/core';
|
refactor(Location): out of router and into platform/common
closes https://github.com/angular/angular/issues/4943
BREAKING CHANGE:
`Location` and other related providers have been moved out of `router` and into `platform/common`. `BrowserPlatformLocation` is not meant to be used directly however advanced configurations may use it via the following import change.
Before:
```
import {
PlatformLocation,
Location,
LocationStrategy,
HashLocationStrategy,
PathLocationStrategy,
APP_BASE_HREF}
from 'angular2/router';
import {BrowserPlatformLocation} from 'angular2/src/router/location/browser_platform_location';
```
After:
```
import {
PlatformLocation,
Location,
LocationStrategy,
HashLocationStrategy,
PathLocationStrategy,
APP_BASE_HREF}
from 'angular2/platform/common';
import {BrowserPlatformLocation} from 'angular2/src/platform/browser/location/browser_platform_location';
```
Closes #7962
2016-04-08 00:31:20 -07:00
|
|
|
import {
|
|
|
|
|
BrowserPlatformLocation
|
|
|
|
|
} from 'angular2/src/platform/browser/location/browser_platform_location';
|
|
|
|
|
import {PlatformLocation} from 'angular2/platform/common';
|
2016-01-21 09:58:28 -08:00
|
|
|
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A list of {@link Provider}s. To use the router, you must add this to your application.
|
|
|
|
|
*
|
|
|
|
|
* ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* import {Component} from 'angular2/core';
|
|
|
|
|
* import {
|
|
|
|
|
* ROUTER_DIRECTIVES,
|
|
|
|
|
* ROUTER_PROVIDERS,
|
|
|
|
|
* RouteConfig
|
|
|
|
|
* } from 'angular2/router';
|
|
|
|
|
*
|
|
|
|
|
* @Component({directives: [ROUTER_DIRECTIVES]})
|
|
|
|
|
* @RouteConfig([
|
|
|
|
|
* {...},
|
|
|
|
|
* ])
|
|
|
|
|
* class AppCmp {
|
|
|
|
|
* // ...
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* bootstrap(AppCmp, [ROUTER_PROVIDERS]);
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
export const ROUTER_PROVIDERS: any[] = CONST_EXPR([
|
|
|
|
|
ROUTER_PROVIDERS_COMMON,
|
|
|
|
|
CONST_EXPR(new Provider(PlatformLocation, {useClass: BrowserPlatformLocation})),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Use {@link ROUTER_PROVIDERS} instead.
|
|
|
|
|
*
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
|
|
|
|
export const ROUTER_BINDINGS = ROUTER_PROVIDERS;
|