Angular 19 introduced the Resource API for the following purposes:
- Fetch data from the API
- Update data locally
- Asynchronously load a local resource
It should not be used for mutation, such as POST operations. Read more about the resource API here.
However, there was an issue when working with the Resource API. One major problem was that it wasn’t built on top of HttpClient, which meant that interceptors did not function as expected.
To address the above problem, Angular 20 introduces the httpResource API.
The httpResource extends the Resource API by using the HttpClient under the hood, providing a seamless way to make HTTP requests while supporting interceptors and existing testing tools.
- httpResource is built on top of the resource primitive.
- It uses HttpClient as its loader.
- It serves as an abstraction for @angular/common/http.
- It makes HTTP requests through Angular’s HTTP stack.
- It works with interceptors.
Read full article here
https://www.telerik.com/blogs/getting-started-httpresource-api-angular
Thanks for reading.
Discover more from Dhananjay Kumar
Subscribe to get the latest posts sent to your email.