Address feedback

This commit is contained in:
Giuseppe Digilio
2021-07-20 11:54:25 +02:00
parent f7ebffec45
commit d3fe33a837
5 changed files with 22 additions and 9 deletions

View File

@@ -108,11 +108,14 @@ export class FormService {
});
}
/**
* Check if form group has an invalid form control
* @param formGroup The form group to check
*/
public hasValidationErrors(formGroup: FormGroup | FormArray): boolean {
let hasErrors = false;
const fields: string[] = Object.keys(formGroup.controls);
for (const field of fields) {
// Object.keys(formGroup.controls).forEach((field) => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
hasErrors = !control.valid && control.touched;
@@ -122,7 +125,6 @@ export class FormService {
if (hasErrors) {
break;
}
// });
}
return hasErrors;
}