Here's how it currently works with Angular 4.1.0 - 5.1.3:
class YourComponent {
@ViewChild("yourForm")
yourForm: NgForm;
onSubmit(): void {
doYourThing();
// yourForm.reset(), yourForm.resetForm() don't work, but this does:
this.yourForm.form.markAsPristine();
this.yourForm.form.markAsUntouched();
this.yourForm.form.updateValueAndValidity();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…