问题描述
我正在将 Angular 2 应用程序从 RC5 升级到 RC7.@angular/forms 包版本是 0.3.0,我找不到更新的.
I'm in the process of upgrading an Angular 2 app from RC5 to RC7. @angular/forms package version is 0.3.0, and I could not find a newer one.
不过,在 2.0.0-rc.6 中,Type
声明被弃用,取而代之的是 Type
.但看起来表单包需要更新,因为现在在构建时我遇到了一堆错误,例如:
Still, in 2.0.0-rc.6 the Type
declaration was deprecated in favour of Type<T>
. But it looks like forms package needs to be updated, as now when building I got a bunch of errors like:
[default] path/to/my/project/node_modules/@angular/forms/src/directives.d.ts 中的错误:26:45通用类型Type"需要 1 个类型参数.
有谁知道是否有更新版本的表单包?通过列出 npm show @angular/forms@* version
似乎不是:
Does anyone know if there's a newer version of forms package? By listing with npm show @angular/forms@* version
it seems not:
@angular/[email protected] '0.1.0'
@angular/[email protected] '0.1.1'
@angular/[email protected] '0.2.0'
@angular/[email protected] '0.3.0'
还有其他解决方法吗?虽然都是候选版本,但对于 2 个 RC 版本却留下了如此重要的包,这似乎很奇怪.
Is there any other workaround? Although being all release candidates, it seems strange that such a crucial package has been left behind for 2 RC versions.
TA
推荐答案
确保使用 RC7 你有以下 package.json 文件
Make sure with RC7 you have following package.json file
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.7",
"@angular/compiler": "2.0.0-rc.7",
"@angular/core": "2.0.0-rc.7",
"@angular/forms": "2.0.0-rc.7",
"@angular/http": "2.0.0-rc.7",
"@angular/platform-browser": "2.0.0-rc.7",
"@angular/platform-browser-dynamic": "2.0.0-rc.7",
"@angular/router": "3.0.0-rc.3",
"@angular/upgrade": "2.0.0-rc.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.21",
"angular2-in-memory-web-api": "0.0.19",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^1.8.10",
"typings":"^1.3.2"
}
}
这篇关于angular 2 RC7 的哪个@angular/forms 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!