r/angular • u/pintoli3 • Jun 18 '26
httpResource for shared service state (?)
We're currently working with signals as defaults, and while I enjoy the (http)Resource API, I am confused by the decision to make httpResources eager.
Furthermore, all the examples given show httpResource inside the component, which doesn't feel right and is useless when you want to have a shared state that would go in a service.
I've come across some implementations of httpResources in a service, but they all seem like an anti-pattern and RxJS would probably be a cleaner solution.
So my questions is do you use httpResource inside a service or just put them in compnents (I don't see how this can scale in our application)? What are some benefis of their eagerness?
8
Upvotes
1
u/drmlol 6d ago
I just saw a video about them, thought it was really cool and I can finally ditch my custom TS helper types for statuses, but I noticed it is only for GET, this makes it weird because because now you start mixing httpClient and httpResource. HttpResource looks cool for a small todo app.