Angular 2.0.0 Metadata_resolver奇怪的行为
我将我的应用程序从角度2 RC5与
angular-webpack脚手架迁移到角度2 2.0.0与角cli beta 14.
我正在与这些错误进行战斗:
和
如果我删除应用程序的几个组件,这是一个奇怪的行为.但是如果我添加一个简单的组件,如: @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有关(第二个问题) 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: 此代码正常工作: this.publicService.all().subcribe(response => { console.log(response); }); 此代码失败: this.publicService.all().subcribe(response => { deserialize(response) }); 上述异常:
???
environment.ts
// Angular 2 // rc2 workaround import { enableDebugTools,disableDebugTools } from '@angular/platform-browser'; import { enableProdMode,ApplicationRef } from '@angular/core'; // Environment Providers let PROVIDERS: any[] = [ // common env directives ]; // Angular debug tools in the dev console // https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md let _decorateModuleRef = function identity<T>(value: T): T { return value; }; if ('production' === ENV) { // Production disableDebugTools(); enableProdMode(); PROVIDERS = [ ...PROVIDERS,// custom providers in production ]; } else { _decorateModuleRef = (modRef: any) => { const appRef = modRef.injector.get(ApplicationRef); const cmpRef = appRef.components[0]; let _ng = (<any>window).ng; enableDebugTools(cmpRef); (<any>window).ng.probe = _ng.probe; (<any>window).ng.coreTokens = _ng.coreTokens; return modRef; }; // Development PROVIDERS = [ ...PROVIDERS,// custom providers in development ]; } export const decorateModuleRef = _decorateModuleRef; export const ENV_PROVIDERS = [ ...PROVIDERS ]; app.module.ts @NgModule({ providers: [ // expose our Services and Providers into Angular"s dependency injection ENV_PROVIDERS ],bootstrap: [AppComponent] }) export class AppModule { } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |