错误信息
VM556 angular2-polyfills.js:349错误:必须定义令牌!(...)
要么
错误TS2305:模块'"/ node_modules/angular2/router"'没有导出成员'LocationStrategy'.
错误TS2305:模块'"/ node_modules/angular2/router"'没有导出成员'HashLocationStrategy'.
错误TS2305:模块'"/ node_modules/angular2/router"'没有导出的成员'Location'.
怎么修
Gün*_*uer 30
更新> = rc.5
@NgModule({
providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy}]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
更新> = rc.0
import {
PlatformLocation,
Location,
LocationStrategy,
HashLocationStrategy,
PathLocationStrategy,
APP_BASE_HREF}
from '@angular/common';
import {BrowserPlatformLocation} from '@angular/platform-browser';
Run Code Online (Sandbox Code Playgroud)
原版的
更改
import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router';
Run Code Online (Sandbox Code Playgroud)
至
import {ROUTER_PROVIDERS} from 'angular2/router';
import {LocationStrategy, HashLocationStrategy} from 'angular2/platform/common';
Run Code Online (Sandbox Code Playgroud)
另请参阅
- 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';
Run Code Online (Sandbox Code Playgroud)
通常由此更改引起的另一个错误是
location.createComponent不是函数
归档时间: |
|
查看次数: |
11973 次 |
最近记录: |