Angular 2 RC2 新表单 [英] Angular 2 RC2 New Forms
问题描述
如文章中所建议:
https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub
为了在 RC2 中使用新表单,我们需要使用以下代码禁用已弃用的表单:
that in order to use new forms in RC2 we need to disable deprecated forms using below code:
import {disableDeprecatedForms, provideForms} from '@angular/forms';
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms()
])
这显然意味着我们现在还需要在 package.json 中包含以下内容:
Which apparently means that we now also need to include below in our package.json:
"@angular/forms": "2.0.0-rc.2",
但是当我将 "@angular/forms": "2.0.0-rc.2" 添加到我的 package.json 并尝试恢复包时,它会出现以下错误:
But when I add "@angular/forms": "2.0.0-rc.2", to my package.json and try to restore packages it gives below errors:
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 文件中:
Just found that in order to use new forms introduced in Angular 2 RC2, we need to add below package to our packages.json file:
"@angular/forms": "0.1.0"
您可能还会发现以下答案很有用:
You may also find below answer useful:
如何将 Angular 2 RC 1(或更早版本)表单迁移到 Angular 2 RC 2/RC 4 新表单
这篇关于Angular 2 RC2 新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!