Skip to content

Instantly share code, notes, and snippets.

@sihu
Last active June 25, 2018 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sihu/d6c9a54858d49a0e4d6c043afeb22101 to your computer and use it in GitHub Desktop.
Save sihu/d6c9a54858d49a0e4d6c043afeb22101 to your computer and use it in GitHub Desktop.
Print form groups validity
printValidility(formGroup: FormGroup) {
return Object.keys(formGroup.controls).reduce((acc, current) => {
if ((formGroup.controls[current] as FormGroup).controls) {
acc[current] = this.printValidility(formGroup.controls[current] as FormGroup);
} else {
acc[current] = formGroup.controls[current].valid;
}
return acc;
}, {});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment