Bit confused about how to use Forms(template or modal driven froms) in the angular2 beta.
currently i am using modal driven forms but getting some error here is my f
Try using new RadioButtonState(boolean, string)
in your formbuilder.
ex.
Template:
Component
// create the form as a colleciton of Controls
this.form = formBuilder.group({
disOrDat: formBuilder.group(
{
dis: [new RadioButtonState(true, 'dis')],
dat: [new RadioButtonState(false, 'dat')]
},
{
validator: this.disOrDatValidator
}
)
});
disOrDatValidator(group: ControlGroup) {
/* tslint:disable:no-string-literal */
if (group.controls['dis'].value !== group.controls['dat'].value) {
/* tsslint:enable:no-string-literal */
return false;
}
// return null means validation passed
return null;
}
doIt() {
// handle form submit
}