I'm trying to create a component where you can pass which pipe that should be used for a list inside the component. From what I could find by testing and looking around for answers the only solution appears to create something like:
<my-component myFilter="sortByProperty"></my-component>
my-component
template:
<li *ngFor="#item of list | getPipe:myFilter"></li>
Which then maps myFilter
to the correct pipe logic and runs it, but this seems a bit dirty and not optimal.
I thought they would have come up with a better solution to this problem since Angular 1 where you would also do something along these lines.
Is there not a better way to do this in Angular 2?
See Question&Answers more detail:os