Thanks. Is there any way to add a custom validation for the entire group? Normally, I'd do so like this:
createFormGroup() {
this.myForm = this.fb.group({
mobile : new FormControl(''),
homePhone : new FormControl('')
// our custom validator
}, { validator: this.atLeastOnePhoneRequired});
}
but in the form using ngx-sub-form I'm using code like this:
protected getFormControls(): Controls {
return {
mobile : new FormControl(null),
homePhone : new FormControl(null)
};
}
Software engineer, I've been working with Angular for 6 years now and strive to work more full stack. I publish on dev.to about topics I love around open source, frontend, data privacy, automations.
Thanks. Is there any way to add a custom validation for the entire group? Normally, I'd do so like this:
createFormGroup() {
this.myForm = this.fb.group({
mobile : new FormControl(''),
homePhone : new FormControl('')
// our custom validator
}, { validator: this.atLeastOnePhoneRequired});
}
but in the form using ngx-sub-form I'm using code like this:
protected getFormControls(): Controls {
return {
mobile : new FormControl(null),
homePhone : new FormControl(null)
};
}
Yes, there's definitely a way to do that.
Search
getFormGroupControlOptions
on the README :)