I have my pipe filter that receives an object defined in the html, only that I have to define the attributes that it will filter. how can I generate my filter without having to pass the parameters of the html?. I would like you to filter all the columns in general.
HTML----
<tr *ngFor="let view of list | filter : { id:searchText, name:searchText,
age:searchText }">
<td>{{view.id}}</td>
<td>{{view.name}}</td>
<td>{{view.age}}</td>
</tr>
PIPE---
export class FilterPipe implements PipeTransform {
transform(value: any, searchText: any): any {
let filterKeys = Object.keys(searchText);
return value.filter(item => {
return filterKeys.some((keyName) => {
return new RegExp(searchText[keyName], 'gi').test(item[keyName]);
});
});
}
}