更新 >= rc.5
@NgModule({
providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy}]
})
export class AppModule {}
更新 >= rc.0
import {
PlatformLocation,
Location,
LocationStrategy,
HashLocationStrategy,
PathLocationStrategy,
APP_BASE_HREF}
from '@angular/common';
import {BrowserPlatformLocation} from '@angular/platform-browser';
原创
改变
import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router';
到
import {ROUTER_PROVIDERS} from 'angular2/router';
import {LocationStrategy, HashLocationStrategy} from 'angular2/platform/common';
另见
- https://github.com/angular/angular/issues/8229
移动出口的完整列表:
- https://github.com/angular/angular/pull/8230/files
import {
PlatformLocation,
Location,
LocationStrategy,
HashLocationStrategy,
PathLocationStrategy,
APP_BASE_HREF}
from 'angular2/platform/common';
import {BrowserPlatformLocation} from 'angular2/src/platform/browser/location/browser_platform_location';
此更改通常导致的另一个错误是
location.createComponent 不是函数