I am a very new user of Angualr and currently using Angular 10. I want the textarea field that should be empty after click on the clear button. But this code is not working that I want to do. Could someboday help me. Thanks.
HTM file
<button (click)="ClearField()" type="button">clear field</button>
<textarea class="form-control rows=10 cols=50 cstm-textarea" #box (keyup)="OnUpdateTextArea(box.value)">
</textarea>
.ts file
export class AppComponent {
str = '';
OnUpdateTextArea(value: string) {
this.str = value;
console.log("text area value:", this.str);
}
ClearField() {
this.str = '';
}
}