angular impure pipe triggered only on service changes

Discussão em 'Angular' iniciado por Mako, Dezembro 14, 2024.

  1. Mako

    Mako Guest

    Am implementing a service named MyService (singleton) which has an attribute called config, and a pipe named MyPipe which should only be re-evaluated when MyService.config (not the input into the pipe!) is changed (the transform function actually uses MyService.config in the transformation logic). Is it possible at all in angular?

    I understood that pure pipes are only re-evaluated when the input is changed and impure pipes are re-evaluated on every change detection cycle. What I want to achieve is a pipe that is re-evaluated NOT when the input is changed, and also NOT on every change detection cycle, but when an unrelated condition happens as mentioned above.

    I actually tried to add a ChangeDetectorRef but didn't succeed, which let me to ask if it's possible at all. Any hints would be very much appreciated!

    Continue reading...

Compartilhe esta Página