As I write this article, Angular 21.0 has been released, and it has changed the way data should be fetched in modern Angular apps. Usually, in an Angular application, data comes from an API and can be categorized as:
- Fetching data from the server
- Mutating data on the server
In modern Angular apps, there are two new signal-based ways to fetch data:
- resource API
- httpResource API
Both the resource and httpResource APIs serve the same purpose, but they differ in how they make HTTP requests. The resource API uses the browser’s native fetch function, while httpResource relies on Angular’s HttpClient service to perform the request.
Since httpResource uses Angular’s built-in HttpClient, it automatically works with other Angular features such as interceptors.
To dive deeper, let us start by creating a model interface that represents the API response structure.
Read full article here – https://www.telerik.com/blogs/data-fetching-modern-angular
I hope you find this article useful. Thanks for reading.
Discover more from Dhananjay Kumar
Subscribe to get the latest posts sent to your email.