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.
👨🏫 Co-Founder of This is Learning, Organizer of AarhusJS
✍️ Writer, Speaker, FOSS Maintainer 📗 Author
🏆 Microsoft MVP 🌟 GitHub Star
🌊 Nx Champion 🦸 Angular Hero of Education
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 iftotalCount$
is hitting the server.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 whatAsyncPipe
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.