I have tried and failed to find the way in which to reset my angular form.
Can somebody help?
<form #thisIsAForm>
<mat-form-field class="full-width">
<input matInput placeholder="Weather">
</mat-form-field>
</form>
<button mat-raised-button (click)="resetForm()">Reset</button>
export class Example{
@ViewChild('thisIsAForm') thisIsAForm;
resetForm() {
this.thisIsAForm.reset();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With