我想要做的是让用户使用多个输入字段过滤数据表。一个是名字,一个是地址,一个是城市等等:
我为名称设置了管道,它正在过滤名称。我需要帮助的是,当用户不断填写不同的文本字段以继续过滤时,我将如何继续实现这一点?
这是我的 pipe.ts:
@Pipe({
name: 'searchfilter'
})
export class SearchfilterPipe implements PipeTransform {
transform(Customers: Customer[], searchValue: string): Customer[] {
if(!Customers || !searchValue){
return Customers;
}
return Customers.filter(customer =>
customer.Name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()));
}
}