Hey everyone, I'm facing a little issue here. I created a pipe filter to sort through some data, but now I need to include two more filters and I'm not sure how to go about it within this pipe. Below is an example of the pipe I have created:
/*** CUSTOM PIPE ***/
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(data: any, search: []): any {
if (search === undefined) { return data }
return data.filter(function(item){
Here, I need to filter by item?.city and item?.age
return item?.title?.includes(search)
})
}
}
/*** HTML ***/
<ion-searchbar [(ngModel)]="search" name="search"></ion-searchbar>