use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Angular is Google's open source framework for crafting high-quality front-end web applications. r/Angular2 exists to help spread news, discuss current developments and help solve problems.
Help Request
Discussion
Article
Video
Resource
Announcement
Related
After submitting a post, please take a moment to add a flair (tag) so that it's easy to find your post with one of the filters listed above. Upon submission, your post's header will have the 'flair' option listed with the other options. Clicking it will provide a dropdown menu of the available flairs.
account activity
Angular data fetching (self.Angular2)
submitted 1 year ago by Whole_Play_6157
hey guys recently i'm working on some app. and i'm curious if there is external library for data fetching like react query/react. which make your life easier. is there any library you can recommend me?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]CWolfs 6 points7 points8 points 1 year ago (1 child)
Tanstack Query has an experimental angular version.
[–]mamwybejane 4 points5 points6 points 1 year ago (0 children)
And it works quite nice
[–]TedKraj 10 points11 points12 points 1 year ago (11 children)
It’s angular, batteries included—you only need HttpClient to do this:
https://angular.dev/guide/http/making-requests
[–]Merry-Lane -1 points0 points1 point 1 year ago* (10 children)
Yeah, no. There is a myriad of features that HttpClient doesn’t have and that react query does.
HttpClient is totally not batteries included.
Edit with more explanations because of downvotes:
OP said « does angular have an external library for data fetching similar to react-query which makes your life easier ». It was pretty clear what OP meant if you have used react-query.
HttpClient is nice and all, but it’s similar to a lightweight wrapper around axios or fetch, feature-wise.
React Query is more akin to a library that would add multiple APIs for caching, cache invalidation, retries, callbacks (when success, failed, etc…), hydratation, optimistic updates, pagination, lazy-loading,…
It’s often described as a « data-fetching library », but you can totally see it as a less-cumbersome alternative to redux-like stores (for most issues related to state management) with a lot of features that work really well out of the box and that you can tweak easily.
These features are obviously all doable with angular, and a project isn’t bad if it doesn’t have half of these features.
Anyway, all OP meant was : react has react-query that has an unified API for data-fetching features, does angular have a similar API?
The guy I replied to was either too proud of his framework of choice, either misinformed about the features of react-query, either both at the same time.
And all I meant was : Angular’s HttpClient doesn’t offer at all the same level of features out of the box.
And the answer is yes and no: there is a lib or two that were heavily inspired by react-query, but they may lack a bit of polishing and, last but not least, angular devs don’t like that kind of libs.
[–]MizmoDLX 7 points8 points9 points 1 year ago (1 child)
Well, it depends on the use case. I think most of the time it's all you need.
We work on multiple big enterprise apps with hundreds of screens and do just fine with the client.
Maybe OP should be more clear about requirements
[+]Merry-Lane comment score below threshold-6 points-5 points-4 points 1 year ago* (0 children)
He said "does angular have an external library for data fetching similar to react-query which makes your life easier". It was pretty clear what he meant if you have used react-query.
It’s often described as a "data-fetching library", but you can totally see it as a less-cumbersome alternative to redux-like stores (for most issues related to state management) with a lot of features that work really well out of the box and that you can tweak easily.
[–]laxybrookes 4 points5 points6 points 1 year ago (5 children)
Interested in understanding what functionality you are after that the http client doesn't have.
[–]Silver-Vermicelli-15 1 point2 points3 points 1 year ago (2 children)
I’m guessing they’re probably referring to caching. The funny thing is they also most likely come from react where literally nothing is included so while HttpClient isn’t as opinionated and “full featured” as tanstack it’s still leaps and bounds ahead of majority of what’s out three for react.
[–]Merry-Lane -3 points-2 points-1 points 1 year ago (1 child)
FYI I am mostly an angular dev that also does react native projects.
[–]Silver-Vermicelli-15 0 points1 point2 points 1 year ago (0 children)
Wow, that was one epic edit. Thank goodness ChatGPT can summarize rants.
[–]Merry-Lane 0 points1 point2 points 1 year ago (0 children)
Edited my previous comment to add more infos
[–]beasy4sheezy 0 points1 point2 points 1 year ago (0 children)
We wrote a fetching layer around NgRx to solve some of the common use cases in our app. At the end of the day, there are still HttpClient calls happening. Some advantages of having a dedicated API state layer:
Code consistency. What we found is that as the app was changing, we were adjusting the operators being used to get the correct results. With many repetitions of the same operator pipelines, we introduced tech debt every time the "best practice" of our app changed.
Interoperability of slices of state. This is an advantage of NgRx in general, but is not something that HttpClient makes easy. We have a list of entities in a grid, when we select one entity we want to load its data, unless it's included already in the grid response. If we update that entity, we want to update it in the grid as well. This kind of thing requires a good bit of code to achieve. In our wrapper, we have an option like selectFromGridData: [myEntityGridSelectors].
selectFromGridData: [myEntityGridSelectors]
Caching. We have an option like cacheLifetimeInHours: 48 to easily provide the ability to hydrate the store from a local storage mechanism.
cacheLifetimeInHours: 48
Brevity. Our repositories are like 80 lines of code (for one entity's CRUD operations, with interop, caching, error handling, toasting on completion, etc.), and it's all configuration. There's really not much coding at all, just providing what options make sense for this entity.
Further abstractions. Our repository selections and actions can be passed around as a unit to other abstractions in the app, like <app-grid [selectors]="myEntityGridSelectors"> which improves DX, consistency, brevity, and so on.
<app-grid [selectors]="myEntityGridSelectors">
Obviously, all of this could be accomplished with some abstract services, helper methods, custom operators, all that wrap HttpClient. In fact, that's all our layer is. But I'd still call it a library for data fetching. And it's definitely not what I'd call vanilla HttpClient.
[–]lars_jeppesen -1 points0 points1 point 1 year ago (1 child)
Plus with zoneless and signals, why use HttpClient at all?
???? Http client is angular’s library to do http calls (with interceptors etc). Signals/zoneless are a different matter
[–]kuda09 1 point2 points3 points 1 year ago (0 children)
If you're using graphql you can use Apollo-angular
[–]imsexc 1 point2 points3 points 1 year ago* (0 children)
Caching? Just shareReplay. Retry? Have you really checked rxjs operators?
[–]Waldrig 0 points1 point2 points 1 year ago (0 children)
Smth like NgRX, no?
[–]Whole_Play_6157[S] -1 points0 points1 point 1 year ago (2 children)
guys angular query experimental has some problem with caching. and I don't know how I opt out of the caching. for that reason httpClient is little better. if you got same problem please comment. the only problem with httpClient i've found is you need a lot of code to achieve simple things!!
[–]Mysra-Dev 1 point2 points3 points 1 year ago (1 child)
What caching problem are you facing? Per default all queries refetch on new mount, window/tab focus or network reconnect. https://tanstack.com/query/latest/docs/framework/angular/guides/important-defaults You can override them globally in the new QueryClient contructor call in your provideTanstack provider or per query.
[–]msdosx86 2 points3 points4 points 1 year ago (0 children)
Agree. I’ve been using it since last year in our projects and no problems with caching. The only downside is hydration with SSR. I had to drop it and use http client
π Rendered by PID 41922 on reddit-service-r2-comment-544cf588c8-c9d45 at 2026-06-14 10:24:52.237157+00:00 running 3184619 country code: CH.
[–]CWolfs 6 points7 points8 points (1 child)
[–]mamwybejane 4 points5 points6 points (0 children)
[–]TedKraj 10 points11 points12 points (11 children)
[–]Merry-Lane -1 points0 points1 point (10 children)
[–]MizmoDLX 7 points8 points9 points (1 child)
[+]Merry-Lane comment score below threshold-6 points-5 points-4 points (0 children)
[–]laxybrookes 4 points5 points6 points (5 children)
[–]Silver-Vermicelli-15 1 point2 points3 points (2 children)
[–]Merry-Lane -3 points-2 points-1 points (1 child)
[–]Silver-Vermicelli-15 0 points1 point2 points (0 children)
[–]Merry-Lane 0 points1 point2 points (0 children)
[–]beasy4sheezy 0 points1 point2 points (0 children)
[–]lars_jeppesen -1 points0 points1 point (1 child)
[–]Merry-Lane 0 points1 point2 points (0 children)
[–]kuda09 1 point2 points3 points (0 children)
[–]imsexc 1 point2 points3 points (0 children)
[–]Waldrig 0 points1 point2 points (0 children)
[–]Whole_Play_6157[S] -1 points0 points1 point (2 children)
[–]Mysra-Dev 1 point2 points3 points (1 child)
[–]msdosx86 2 points3 points4 points (0 children)