Forked from JohannesHoppe/get-form-validation-errors.ts
Created
February 8, 2021 15:26
-
-
Save borisBelloc/abd4219a6e098bf0b31d3e2869f00e7f to your computer and use it in GitHub Desktop.
Revisions
-
JohannesHoppe revised this gist
Jul 19, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export function getFormValidationErrors(form: FormGroup) { if (controlErrors) { Object.keys(controlErrors).forEach(keyError => { result.push({ 'control': key, 'error': keyError, 'value': controlErrors[keyError] }); -
JohannesHoppe renamed this gist
May 30, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
JohannesHoppe created this gist
May 30, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import { FormGroup, ValidationErrors } from '@angular/forms'; export function getFormValidationErrors(form: FormGroup) { const result = []; Object.keys(form.controls).forEach(key => { const controlErrors: ValidationErrors = form.get(key).errors; if (controlErrors) { Object.keys(controlErrors).forEach(keyError => { result.push({ 'control ': key, 'error': keyError, 'value': controlErrors[keyError] }); }); } }); return result; }