I'd like to have a generic fields filter that will get the filter function as an argument and use it in filter
import {Injectable, Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'FieldsFilter'
})
@Injectable()
export class FieldsFilter implements PipeTransform {
transform(fields: any[], args: any[]): any {
return fields.filter(args[0]);//pass function to filter
}
}
So I could use it in multiple places with different filter functions.
How do I pass the filter function?
this
in the argument function. how do I bind it? – Isagoge