隨着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