I have a pipe class which returns data based on the arguments you are passing. I know how to use it in my template HTML using the | symbol, but I want to use it
I would instance it and call it "transform" method. I would do so:
Here is a sample with sample value and parameters:
import {FilterPipe} from './my.pipe';
(...)
@Component({
(...)
})
export class SomeComponent {
someMethod() {
var val = [
{ name: 'test', fieldName: 'fieldvalue' },
(...)
];
var params = [ 'fieldName', 'fieldValue' ];
var p = new FilterPipe();
var result = p.transform(val, params);
}
}
In the template this would be used for example this way:
{{elt.name}}