Manually trigger pipe update

First way: paremeter

One way to make a Pure Pipe becoming impure is add a parameter to your Pipe.

when you want to refresh, just change the parameter.


Second way: without parameter

Pure Pipe will be fired when its input has a new instance. So with TypeScript 2.1+, the below code will copy the original object with a new instance, and lead pure pipe to be fired.

    let copy = { ...original }

Negative impact

This will force your component to refresh your pipe every time a variable changes his value, even if this isn’t the one used within the pipe contains


Stackblitz

Both ways are included in stackbliz demo.

Leave a Comment