I am setting an input field to a variable I am defining, this is used to filter through my table on the front-end. It does not want to return any values unless a key is entered within the input field. How can I get the filter to work without the input field expecting back a key event. I want it to return values immediately when the 'filteredValue'
is assigned.
HTML
<mat-form-field appearance="outline" *ngIf="filteredValue">
<mat-label>Filter 1</mat-label>
<input matInput
type="text"
(input)="doFilter($event.target.value)"
placeholder="Ex. BMW"
value="{{filteredValue | lowercase }}">
</mat-form-field>
component.ts
ngOnInit() {
if (this.urlMM) {
this.filteredValue = this.urlMM + ' ' + this.urlMake + ' ' + this.urlYear;
}
}
public doFilter = (value: string) => {
this.dataSource.filter = value.trim().toLowerCase();
}