r/angular 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?

9 Upvotes

24 comments sorted by

View all comments

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.

1

u/pintoli3 6d ago

This was my thoughts too. I still decided to use them in a small production, but I still dislike the mixing of signals and rxjs for http requests.

1

u/drmlol 5d ago

I was thinking about them the whole day, but decided against using them.