文章中建议:
https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub
为了在 RC2 中使用新表单,我们需要使用以下代码禁用已弃用的表单:
import {disableDeprecatedForms, provideForms} from '@angular/forms';
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms()
])
这显然意味着我们现在还需要在 package.json 中包含以下内容:
"@angular/forms": "2.0.0-rc.2",
但是当我将“@angular/forms”:“2.0.0-rc.2”添加到我的 package.json 并尝试恢复包时,它会出现以下错误:
npm ERR! node v6.2.1
npm ERR! npm v3.9.3
npm ERR! No compatible version found: @angular/forms@2.0.0-rc.2
npm ERR! Valid install targets:
npm ERR! 0.1.0
谁能指导一下?
最佳答案
刚刚发现,为了使用 Angular 2 RC2 中引入的新表单,我们需要将以下包添加到我们的 packages.json 文件中:
"@angular/forms": "0.1.0"
您可能还会发现以下答案很有用:
How to migrate Angular 2 RC 1 (or earlier) Forms to Angular 2 RC 2 / RC 4 New Forms
关于Angular 2 RC2 新形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37864577/