我有一个运行在Angular RC 6版本上的Angular2应用程序。 现在我正在尝试将其升级到Angular2.2版本。
但是我在浏览器上遇到以下错误:
时出错
以下是我的配置文件:
package.json
:
{
"name": "frontend",
"version": "1.0.0",
"description": "Re-writing the outdated application.",
"private": true,
"author": {
"name": "ashishr",
"email": "aashish.ab"gmail.com"
},
"scripts": {
"build.dev": "gulp build.dev",
"build.dev.watch": "gulp build.dev.watch",
"build.e2e": "gulp build.e2e",
"build.prod": "gulp build.prod",
"build.test": "gulp build.test",
"build.test.watch": "gulp build.test.watch",
"docs": "npm run gulp -- build.docs && npm run gulp -- serve.docs",
"e2e": "protractor",
"e2e.live": "protractor --elementExplorer",
"gulp": "gulp",
"karma": "karma",
"karma.start": "karma start",
"postinstall": "typings install && gulp check.versions && npm prune",
"reinstall": "npm cache clean && npm install",
"serve.coverage": "remap-istanbul -b src/ -i coverage/coverage-final.json -o coverage -t html && npm run gulp -- serve.coverage",
"serve.dev": "gulp serve.dev",
"serve.e2e": "gulp serve.e2e",
"serve.prod": "gulp serve.prod",
"start": "gulp serve.dev",
"tasks.list": "gulp --tasks-simple",
"test": "gulp test",
"webdriver-start": "webdriver-manager start",
"webdriver-update": "webdriver-manager update"
},
"devDependencies": {
"async": "^1.4.2",
"browser-sync": "^2.11.1",
"chalk": "^1.1.1",
"connect": "^3.4.1",
"connect-history-api-fallback": "^1.1.0",
"connect-livereload": "^0.5.3",
"del": "^2.2.0",
"event-stream": "^3.3.2",
"express": "~4.13.1",
"extend": "^3.0.0",
"gulp": "^3.9.0",
"gulp-concat": "^2.5.2",
"gulp-cssnano": "^2.0.0",
"gulp-filter": "^2.0.2",
"gulp-inject": "^1.3.1",
"gulp-inline-ng2-template": "^1.0.0",
"gulp-load-plugins": "^0.10.0",
"gulp-plumber": "~1.0.1",
"gulp-shell": "~0.4.3",
"gulp-sourcemaps": "~1.5.2",
"gulp-template": "^3.0.0",
"gulp-tslint": "^4.3.2",
"gulp-tslint-stylish": "^1.0.4",
"gulp-typedoc": "^1.2.1",
"gulp-typescript": "~2.8.2",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.2.4",
"jasmine-core": "~2.3.4",
"jasmine-spec-reporter": "^2.4.0",
"karma": "~0.13.21",
"karma-chrome-launcher": "~0.2.0",
"karma-coverage": "^0.5.3",
"karma-ie-launcher": "^0.2.0",
"karma-jasmine": "~0.3.6",
"karma-mocha-reporter": "^1.1.1",
"karma-phantomjs2-launcher": "^0.4.0",
"merge-stream": "^1.0.0",
"ng2lint": "0.0.6",
"open": "0.0.5",
"protractor": "^3.0.0",
"remap-istanbul": "^0.5.1",
"rimraf": "^2.5.2",
"run-sequence": "^1.1.0",
"semver": "^5.0.3",
"serve-static": "^1.9.2",
"slash": "~1.0.0",
"stream-series": "^0.1.1",
"systemjs-builder": "^0.15.7",
"tiny-lr": "^0.2.1",
"traceur": "^0.0.91",
"ts-node": "1.7.0",
"tslint": "^3.3.0",
"typedoc": "^0.3.12",
"typescript": "^2.0.3",
"typings": "^0.6.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"yargs": "^3.32.0"
},
"dependencies": {
"@angular/common": "~2.2.0",
"@angular/compiler": "~2.2.0",
"@angular/core": "~2.2.0",
"@angular/http": "~2.2.0",
"@angular/forms": "~2.2.0",
"@angular/platform-browser": "~2.2.0",
"@angular/platform-browser-dynamic": "~2.2.0",
"@angular/router": "~3.2.0",
"@angular/router-deprecated": "^2.0.0-rc.2",
"@angular/upgrade": "~2.2.0",
"bootstrap": "^3.3.6",
"es6-module-loader": "^0.17.8",
"es6-shim": "^0.35.1",
"gulp-debug": "^2.1.2",
"moment": "^2.12.0",
"ng2-bootstrap": "^1.0.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.12",
"systemjs": "~0.19.18",
"zone.js": "0.6.21"
}
}
main.ts
档案:
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
if ('<%= ENV %' === 'prod') { enableProdMode(); }
platformBrowserDynamic().bootstrapModule(AppModule);
app.module
:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app/components/app.component';
@NgModule(
{
imports: [
BrowserModule,
FormsModule,
httpModule
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
请帮我将其迁移到Angular 2.2版本。