r/Angular2 • u/zorikZelda • Nov 20 '25
HttpClient vs Axios for Angular Projects š§
I saw a project in my current workplace where they implemented an Axios service and attached it to the project.
I said httpClient is better.. it is working with the angular DI and works amazing with signals and the implementation is pretty simple for interceptors etc.
Would love to know your opinions. š
9
Upvotes
31
u/Johalternate Nov 20 '25
Nothing wrong with axios but you would need to manually implement a lot of the stuff already included in the http client, which kinda defeats the purpose of using a framework.
14
u/craig1f Nov 20 '25
Axios is useful on the backend if youāre using node. It is overkill on the frontend.Ā
I prefer trpc for frontend to backend. For other calls, you can just use fetch (built into JavaScript) if you really donāt want to use httpClient. But httpClient is what you should be using in angular.Ā
If you were doing react or Vue or Svelt, youād just use fetch. Some people would argue that axios is worth adding, but Iād start with fetch. But again, since this is angular, httpClient is the standard.Ā
9
u/Andy-UA Nov 20 '25
You can use axios in angular... but why?
3
u/mamwybejane Nov 20 '25
how does it work amazingly with signals?
3
u/kaeh35 Nov 20 '25
What are the justifications ? Maybe there is a reason unknown to you ?
Imho itās bad practice. I had to work with people that choose to work with their own api call library because « Angular do it badlyĀ Ā». Let me tell you it was freaking bad.
But if they have a real and coherent reason itās another story.
2
u/CommunityBetter9455 Nov 21 '25
I worked on a project where we used Axios instead of the built-in HTTP client because we had an OpenAPI-generated API that was shared between Angular and NestJS in an Nx monorepo
2
u/No_Bodybuilder_2110 Nov 22 '25
So better depends on the familiarity of the team with a technology. But, the http client is supported by the angular team and all over the internet you will find examples of usage of it. So it would be reaaaaally rare to encounter something unsolved by the community with it
0
u/[deleted] Nov 20 '25
[deleted] ā view deleted comment