Need help with implementing a search feature that can search all values in Angular2. Here's the current code snippet:
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(projects: any, search: any): any {
if(search === undefined) return projects;
return projects.filter(function(project)
{
return project.name.toLowerCase().includes(search.toLowerCase());
})
}
}
Currently, this code only searches by name. How can it be modified to search all values in the table (e.g., id, name, surname, country, etc.)?