Form imports not working with rc0

After changing from 2 beta.11 to 2.rc0 forms stopped working. What is the library that need to be imported to get this working?

import {FORM_DIRECTIVES, FormBuilder,  ControlGroup, Validators,Control } from '@angular/common';

ts] Module ‘“c:/myapps/ionic2-tests/mmsapp/node_modules/@angular/common/index”’ has no exported member ‘ControlGroup’.

Try to replace ControlGroup with FormGroup

Yes that works. But what about Control?

I use something like this in my code

(<Control>this.userDetails.controls['DisplayName']).updateValue(this.userData.DisplayName);

Control is FormControl, and i did’nt achieve to update the value.
I use this little hack : i instanciate a new FormControl with the new value <FormControl> ctrl = new FormControl('new value', Validators.required);

1 Like

Try with this line:

import { FormBuilder, Validators, FormGroup } from ‘@angular/forms’;

There are no longer ControlGroup and Control in angular2 stable.

You can replace ControlGroup by FormGroup and Control by FormControl

2 Likes

Yes, but now the real question is : what about update() on FormControl ?

Now it is setValue

Angular2 (stable) has a lot of changes from the RC4 that was used before Ionic RC0, so take a look at api doc or change log since RC4

AbstractControl
FormControl
FormGroup

2 Likes

check @ecureuill ’ s comments… that worked for me. Though I am still solving other compilation errors, so havent tested yet for working of the set value yet.

it should work though

Yeh, errors are gone will update on working as soon as I clear other compilation errors.

But i am getting this error now.

When I am trying to serve.

I am using this.
import {FormBuilder, FormGroup, Validators, FormControl } from ‘@angular/forms’;

did you solve this issue?

that was an issue with imports and declaration variable in the app.module.ts. I solved it by removing some providers, imports and declaration that doesnt have to be there.

Thank you @ecureuill