随着Angular 2.0的最终版本,我们的应用程序需要进行迁移。我首先从RC4移植到RC5,然后再移植到最终。我遵循从barbarianmeetscoding-updating-your-angular-2-app-from-rc4-to-rc5-a-practical-guide和angular.io - rc4-to-rc5.html的迁移步骤。Angular 2 RC4到RC5的迁移
我们的应用程序是一个具有100个奇数组件的大型应用程序。我的问题是,为了成功迁移,我应该一次对所有组件进行更改还是可以一次将它们组成一个组件?
我已经对main.ts,package.json,app.ts和app.module.ts进行了必要的修改。首先,我将组件指令和提供程序从app.ts移至app.module,并对app.routes进行了必要的更改。 但我得到以下错误
但是,在提到的组件中没有明确使用toString()。
app.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import * as ngCore from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule} from '@angular/http';
import {HTTP_PROVIDERS} from '@angular/http';
import {routing} from './app.routes';
import { App} from './app';
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
import {HttpService} from '../service/http/httpService';
import {Button} from '../components/button';
import {Checkbox} from '../components/checkbox';
import {PipeSafe} from "../pipe/pipe-safe";
import {OrderBy} from "../pipe/orderby";
import {Number} from '../pipe/number';
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing
],
declarations: [
App,
PipeSafe,
OrderBy,
Number
],
providers: [
ngCore.provide(LocationStrategy, {useClass: HashLocationStrategy}),
ngCore.provide('TemplateComponents', { useValue: {
'button': Button,
'checkbox': Checkbox,
}}),
HttpService
],
bootstrap: [ App ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
你检查[这](https://github.com/angular/angular/issues/10612 )出来。看起来类似于你正在处理的事情 – Bean0341