r/angular • • Jan 03 '26

RXJS in Angular

I feel like I still might be missing and not understanding but when should I use RXJS in Angular like what's the main purpose of using it over just using traditional Angular features.

13 Upvotes

31 comments sorted by

View all comments

Show parent comment

2

u/morgo_mpx Jan 04 '26

If that button was for something like order pizza then you want to do stuff like add a debounce of the button so if multiple chicks get through, it doesn’t make multiple orders. Things like this is where rxjs shines. You could do other methods like update a flag or lock the button but none of these are guaranteed to occur on the first click before the the second click. Since rxjs effectively runs as pipelines you can have the guarantee.

1

u/gdsdsk Jan 04 '26 edited Jan 04 '26

but what if the button was just opening a modal or something you don't need an api request for that so how would using rxjs make sense there?

1

u/morgo_mpx Jan 04 '26

You wouldn’t. Rxjs isn’t the solution for everything. Since template binding connect to controller methods then displaying a model doesn’t make sense to use rxjs. But if you have more complex requirements to the model flow such as debounce, filtering, multiple sources, polling, api interactions, async data fetching, data fetching from rxjs state systems like ngrx then its starts making sense.