Issue
I would like to markAsDirty
all the controls inside of a FormGroup
.
Solution
Found out that Object.keys
can handle this..
Object.keys(this.form.controls).forEach(key => {
this.form.get(key).markAsDirty();
});
For Angular 8+, use the following (based on Michelangelo answer):
Object.keys(this.form.controls).forEach(key => {
this.form.controls[key].markAsDirty();
});
Answered By - Marcos J.C Kichel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.