How to use a pipe in a component in Angular 2?

后端 未结 4 1275
终归单人心
终归单人心 2021-01-12 05:22

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

4条回答
  •  星月不相逢
    2021-01-12 06:09

    I would keep the reusable part of what you're trying to do in a separate service, which can then be injected anywhere. This feels like a slippery slope to something less testable and reusable.

提交回复
热议问题