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();
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…