1 2 3 4 5 6 7
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'filter' }) export class FilterPipe implements PipeTransform {
8 9
transform(value: any, filterString: string, propName: any): any { console.log('propName: ', propName);
10
if (value.length === 0) {
11 12 13
return value; }
14
const resultArray = [];
15 16
for (const item of value) { console.log('item: ', item);
17
var string1 = item['team'].toLowerCase() + item['COMMENT'].toLowerCase() + item['custgroupName'].toLowerCase();
18
var string2 = filterString.toLowerCase();
19 20
if (string1.indexOf(string2) > -1) { resultArray.push(item);
21
}
22 23
24
25 26
return resultArray; }
27
28