Dynamic pipe in Angular 2

后端 未结 6 958
失恋的感觉
失恋的感觉 2020-12-01 12:35

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

6条回答
  •  独厮守ぢ
    2020-12-01 13:10

    The easiest way to tackle this would be to not use the pipes in the HTML templates, but instead, inject the pipe into a component's constructor (using DI), then apply the transform functionally. This works quite well with an Observable map or similar rxjs streams.

提交回复
热议问题