Last active
November 8, 2018 17:01
-
-
Save tmhpfnr/3f1bf5443e66e1f22e3d08d26e50d0f1 to your computer and use it in GitHub Desktop.
Log angular (reactive) forms field validation status to console
This file contains 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 characters
debugFormValidations(form: FormGroup) { | |
Object.keys(form.controls).forEach(k => { | |
const control = form.controls[k]; | |
// see https://angular.io/api/forms/AbstractControl#status | |
const log = control.invalid ? console['warn'] : console['log']; | |
log(k, 'invalid', control.invalid, 'value', control.value); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment