Last active
March 8, 2024 02:37
-
-
Save av1v3k/ddd385d75e8efc2e5509101e083334f5 to your computer and use it in GitHub Desktop.
re-trigger Validation in angular form after patching
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 characters
Object.values(this.anyform.controls).filter(control => { | |
if (control.invalid) { | |
control.patchValue(control?.value?.length === 0 ? ' ' : control?.value); | |
control.markAsDirty(); | |
control.markAsTouched(); | |
control.setErrors({ incorrect: true }); | |
control.updateValueAndValidity(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment