DEV Community

Discussion on: 7 Deadly Sins of Angular

Collapse
 
raysuelzer profile image
Ray Suelzer

Not to mention, using an async pipe inside of an *ngIf can end up causing a massive number of subscriptions to be created an disposed if an element is toggled frequently.

<strong *ngIf="visible">{{totalCount$ | async}} Selected</strong>
Every time that visible switches from true to false, a brand new subscription is created/disposed to $totalCount. This can have serious performance impacts on an application, not mention it's very easy to end up with this type of code triggering a ton of network requests if totalCount$ is hitting the server.

I'm sure someone has written up a good article on the dangers of the async pipe.

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen • Edited

I'm sure someone has written up a good article on the dangers of the async pipe.

I think AsyncPipe is grossly over-rated. Michael Hladky has talked a lot about what AsyncPipe is missing. He's even working on a range of replacements in the RxAngular (@rx-angular/*) packages.

Come to think of it, I interviewed him about this very topic.