File

src/app/shared/pipes/search-filter.pipe.ts

Metadata

name searchFilter
pure false

Methods

transform
transform(items: any, term: any)
Parameters :
Name Type Optional Description
items any
term any
Returns : any
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'searchFilter',
  pure: false
})
export class SearchfilterPipe implements PipeTransform {

  transform(items: any, term: any): any {
    if (term === undefined) {
      return items;
    }
    return items.filter(function(item) {
      for (const property in item) {
        if (item[property] === null) {
          continue;
        }
        if (item[property].toString().toLowerCase().includes(term.toLowerCase())) {
          return true;
        }
      }
      return false;
    });
  }
}

results matching ""

    No results matching ""