我從遷移RC5 angular2我的應用程序angular-webpack腳手架角2 2.0.0角CLI測試14角2.0.0 Metadata_resolver怪異的行爲
我與這些錯誤的戰鬥:
Uncaught Error: Can't resolve all parameters for PublicInfoDao: (?, ?).CompileMetadataResolver.getDependenciesMetadata @ metadata_resolver.js:508CompileMetadataResolver.getTypeMetadata @ metadata_resolver.js:405(anonymous function) @ metadata_resolver.js:552CompileMetadataResolver.getProvidersMetadata @ metadata_resolver.js:532CompileMetadataResolver.getNgModuleMetadata @ metadata_resolver.js:285RuntimeCompiler._compileComponents @ runtime_compiler.js:126RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55PlatformRef_._bootstrapModuleWithZone @ application_ref.js:303PlatformRef_.bootstrapModule @ application_ref.js:285(anonymous function) @ main.ts:13__webpack_require__ @ bootstrap db3609d…:52(anonymous function) @ .*$:7__webpack_require__ @ bootstrap db3609d…:52webpackJsonpCallback @ bootstrap db3609d…:23(anonymous function) @ main.bundle.js:1
和
metadata_resolver.js:278Uncaught Error: Unexpected value 'AppComponent' declared by the module 'AppModule'(anonymous function) @ metadata_resolver.js:278CompileMetadataResolver.getNgModuleMetadata @ metadata_resolver.js:265RuntimeCompiler._compileComponents @ runtime_compiler.js:126RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55PlatformRef_._bootstrapModuleWithZone @ application_ref.js:303PlatformRef_.bootstrapModule @ application_ref.js:285(anonymous function) @ main.ts:13__webpack_require__ @ bootstrap db3609d…:52(anonymous function) @ .*$:7__webpack_require__ @ bootstrap db3609d…:52webpackJsonpCallback @ bootstrap db3609d…:23(anonymous function) @ main.bundle.js:1 1 : https://github.com/preboot/angular2-webpack
這是一個怪異的行爲的原因,如果我刪除幾個組件的應用作品。但是,如果我添加simplecomponent,如:
@Component({
selector: 'tl-result-item',
templateUrl: "./resultitem.component.html",
styleUrls: ["./resultitem.component.scss"]
})
export class ResultItemComponent {
@Input()
result:Result;
constructor(){}
}
時引發的第二個錯誤。如果我評論@Input()
該應用程序的作品。 有一些服務,如果我取消註釋該應用程序拋出相同的錯誤,如果我評論一些行的錯誤消失。
我對這些錯誤瘋了。我認爲這應該是一個外部問題。
有什麼想法?
更新:
的第一個錯誤可能與https://github.com/AngularClass/angular2-webpack-starter#frequently-asked-questions(第二個問題) 我有幾個問題要遷移到角2.0.0決賽。
UPDATE2:
@NgModule({
providers: [
MetaService,
Title,
HttpInterceptor,
{provide: ConnectionBackend, useClass: XHRBackend},
{provide: Http, useExisting: HttpInterceptor},
{provide: Configuration, useClass: ConfigurationDevelopment}
],
imports: [
BrowserModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
// APP_ROUTER_PROVIDERS
],
declarations: [
AppComponent,
ResultItemComponent,
TimestampToMomentPipe,
TimestampToTimePipe
],
bootstrap: [AppComponent]
})
export class AppModule {
}
UPDATE3: ,在角CLI失敗的代碼另一個例子。
此代碼正常工作:
this.publicService.all().subcribe(response => {
console.log(response);
});
此代碼失敗:
this.publicService.all().subcribe(response => {
deserialize(response)
});
異常上面所解釋的:
Uncaught Error: Can't resolve all parameters for PublicInfoDao: (?, ?).
¿¿??
你有一個github回購重現這個問題? – yurzui
不,但我可以驗證問題是與角度cli有關。我使用舊的腳手架和角2.0.0工作正常。那麼angular-cli會發生什麼? – Serginho
你能分享你的app.module文件嗎? –