parent
dc25dc6da9
commit
cc47e34572
@ -0,0 +1,21 @@ |
||||
import { InfoTable } from './app/model/info-table'; |
||||
import { Pipe, PipeTransform } from '@angular/core'; |
||||
|
||||
|
||||
@Pipe({ |
||||
name: 'filtertable', |
||||
pure: false |
||||
}) |
||||
export class CustomFilterTable implements PipeTransform { |
||||
transform(items: InfoTable[], filter: string): any { |
||||
if (!items || !filter) { |
||||
return items; |
||||
} |
||||
// filter items array, items which match and return true will be
|
||||
// kept, false will be filtered out
|
||||
if(filter){ |
||||
return items.filter(item => item.nameTable.toLowerCase().indexOf(filter) !== -1); |
||||
} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue