Angular 2 - 升级到rc4会抛出脚本错误

时间:2016-08-02 09:07:50

标签: javascript angularjs typescript angular angular2-forms

我尝试将我的angular 2版本更新为2.0.0.rc.4,但是在执行npm install,npm start之后它的throws脚本错误。

请参阅下面的package.json文件

"dependencies": {
"@angular/common":  "2.0.0-rc.4",
"@angular/core":  "2.0.0-rc.4",      
"@angular/compiler":  "2.0.0-rc.4",    
"@angular/http":  "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
"@angular/platform-browser":  "2.0.0-rc.4",
"@angular/platform-browser-dynamic":  "2.0.0-rc.4",
 "@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated":  "2.0.0-rc.2",
"systemjs": "0.19.27",    
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"core-js": "^2.4.0"    
 },
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.7",
"typings":"^0.7.5"

}

下面是我的示例app.component.ts文件

import {Component} from '@angular/core';
import { bootstrap }    from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms';

 import {CORE_DIRECTIVES, FORM_DIRECTIVES, FormBuilder,Validators,Control,ControlGroup } from '@angular/common';

@Component({
selector: 'ej-app',    
templateUrl: 'app/app.component.html',
directives: [ CORE_DIRECTIVES]  
})
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms()
]).catch((err: any) => console.error(err));

export class AppComponent {

employeeDob: Date;
  constructor(private myform: FormBuilder) {
 }

此更改会引发脚本错误,如下所示 enter image description here

请您建议更新角度版本,没有问题

1 个答案:

答案 0 :(得分:3)

更新您的var run = function() { Capacity.find({} , function(err, capacities) { //do stuff return run(); }); } 文件。 systemjs.config.js文件的位置已更改为其自己的包文件夹:

.umd.js

有关详细信息,请查看angular2的quickstart指南