Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

angular2 template - Angular 2 RC2 New Forms

As suggested in article:

https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub

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()
])

Which apparently means that we now also need to include below in our 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

Can anyone please guide?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

How to migrate Angular 2 RC 1 (or earlier) Forms to Angular 2 RC 2 / RC 4 New Forms


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...