I am using an Angular Reactive form as a search form. I want to be able to reset the form. I did this with the following code:
<button type="reset" (click)="onReset()">
Reset
</button>
The reset method does the following:
onReset(){
this.myForm.reset();
this.myForm.markAsPristine();
this.myForm.markAsUntouched();
}
This makes all the form controls empty. But it does not reset the form validation. I deactivate the submit button if the form is not valid. This works when I first use the form. After I click on reset the validation does not work anymore. It seems to be deaktivated after submitting the form.
How can I solve this? What am I missing here?