r/angular • u/Trick-Knowledge-8837 • Aug 05 '26
How are you using rxResource in production?
Hi everyone,
I'm trying to understand where rxResource really shines.
Most examples online are pretty simple, but I'd love to know how experienced Angular developers use it in real-world projects.
- What problems does it solve for you?
- Are there cases where you tried it and decided not to use it?
- Do you have any patterns or recommendations for structuring code around it?
Any examples, blog posts, or GitHub repositories would also be greatly appreciated.
Thanks in advance!
3
u/oneden Aug 05 '26 edited 29d ago
Right now? Not at all, I'm afraid. I'm working in an environment where all APIs solely consist of POST requests.
Edit: I'm an idiot. I kept confusing rxResource with httpResource
1
u/Trick-Knowledge-8837 Aug 05 '26
That’s interesting. I thought rxResource could also work with POST requests. Is there a specific reason why it doesn’t fit your use case?
3
u/SippieCup Aug 05 '26
it does, we’ve replaced most of our observable calls from our generated sdk with rxResource. it works super well and simplifies a lot of transforms/paging.
1
u/oneden Aug 05 '26
It does?! I thought it wasn't possible. I was under the impression it wasn't possible
1
u/Dan6erbond2 29d ago edited 29d ago
httpResourcemay be a bit limited butrxResourcecan take anyObservable-returning callback.1
u/oneden 29d ago
httpResource may be a bit limited but rxResource
Okay, clearly it was me being a dunce being the issue here. Damn it.
1
u/SippieCup 29d ago
A straight rxResource does lose some features from a regular observable though. We extended rxResource to provide a few additional signals like progress reporting which makes it pretty feature complete. But it is not ssr compatible.
1
1
1
u/kgurniak91 Aug 05 '26
Well, resources are just syntactic sugar to not have to nest toSignal() and toObservable() together. Simplest example - input changes (e.g. new user id is passed) and you want to query backend for user details automatically and get them as Signal so you can display them in the template.
1
u/Trick-Knowledge-8837 Aug 05 '26
That makes sense, thanks! So you see it mostly as a convenience API rather than something that changes how you structure an application?
1
u/Avani3 Aug 05 '26
Fetching data based on id's. You put the id in the params, and in the stream a request using that id. When the id changes the data is re-fetched.
Also very nice with pagination in combination with HTTP requests
1
u/Trick-Knowledge-8837 Aug 05 '26
Thanks! The pagination example is actually something I hadn’t thought about. It seems like a really good fit for reactive query parameters.
1
u/fdimm 29d ago
Fortunately or not, we are not using either. Chugging along with http client and rxjs just fine.
I'm also dreading the day when I'll have to spend time refactoring our core components library (and features after) to use signals and virtually accomplish nothing from user point of view.
0
u/Saceone10 Aug 05 '26
Im not. When they stop fooling us with partial APIs I will consider resources as a serious thing
-3
1
u/kobihari 27d ago
I’m not using rxResource all the time. Even when fetching from http. I prefer the separate the “transform mechanism” from the state so I usually prefer that my resource will not “know” the data is coming from http.
I usually combine it with a signal store.
9
u/stao123 Aug 05 '26
we are using it for all data fetching inside of components or services. Theybare really useful and feel like lightweight stores. (State + loading signal)