<form class="example-form">
<mat-form-field class="example-full-width"gt;
<mat-label></mat-label>
<input matInput placeholder="Ex. Pizza" [disabled]="filterValue" />
<mat-label *ngIf="filterValue">Search</mat-label>
<mat-label *ngIf="!filterValue"> No Search</mat-label>
</mat-form-field>
<button mat-raised-button (click)="filter()">Basic</button>
</form>
filterValue: boolean = false;
filter() {
this.filterValue = !this.filterValue;
}
The issue in my app is that if a user writes something in the search box, the filter works. However, when I click the button, the input becomes disabled and empty. How can I preserve the value entered by the user before the input was disabled?