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",
但是,当我在我的package.json中添加"@ angular/forms":"2.0.0-rc.2"并尝试还原软件包时,会出现以下错误:
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中引入的新表单,我们需要在package.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: