table with filterings angular code example
Example 1: mat-header-cell meterial style
const initialSelection = [];
const allowMultiSelect = true;
this.selection = new SelectionModel<MyDataType>(allowMultiSelect, initialSelection);
Example 2: mat-header-cell meterial style
<table mat-table [dataSource]="myDataArray">
...
</table>
Example 3: best way to filter table in angular
@Pipe({
name: 'tableFilter'
})
export class TableFilterPipe implements PipeTransform {
transform(list: any[], value: string) {
return value ? list.filter(item => item.gender === value) : list;
}
}