【发布时间】:2023-03-17 09:55:01
【问题描述】:
随着 Angular 2.0 的最终发布,我们的应用程序需要进行迁移。我首先从 RC4 迁移到 RC5,然后再迁移到 final。我遵循了barbarianmeetscoding-updating-your-angular-2-app-from-rc4-to-rc5-a-practical-guide 和angular.io - rc4-to-rc5.html 的迁移步骤。
我们的应用程序是一个包含 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 { }
【问题讨论】:
-
您检查过this。看起来与您正在处理的相似
标签: angular