I\'m using mat-table. It has a filter which works fine with doc example:
From https://material.angular.io/components/table/overview, the original code is:
Don't forget to apply .trim().toLowerCase()
on your data or you may encounter unexpected results. See my example below:
this.dataSource.filterPredicate = (data:
{name: string}, filterValue: string) =>
data.name.trim().toLowerCase().indexOf(filterValue) !== -1;
applyFilter(filterValue: string) {
this.dataSource.filter = filterValue.trim().toLowerCase();
}