concept impure pipe in category angular

This is an excerpt from Manning's book Angular in Action.
Now imagine that this transform method did some more difficult work. Perhaps you have a large array of items to scan to find how to map a key to a value, and that performance might be suboptimal. You might even have an asynchronous call to handle. These are examples of potential pitfalls when creating impure pipes, as you see in figure 8.9.
Figure 8.9 Example of an impure pipe that loads news at the top of the page by maintaining state in the pipe itself
![]()
Although impure pipes are interesting, I’m certainly of the mindset that you should avoid them if you can. Even the Async pipe is problematic to use in production because it makes error handling difficult. They were made to help in a small set of use cases and are perhaps mostly useful for development, but they make application logic more challenging and difficult to predict.