Member-only story

🔥 ⚡Angular’s new resource and rxResource APIs — Before and After

Concrete examples with and without these API

FAM
4 min readNov 11, 2024
Angular’s new resource and rxResource APIs whereabouts
By FAM

Hi there đź‘‹

Angular’s Resource API and RxResource API are new features introduced in the next week upcoming Angular 19, to simplify asynchronous data retrieval and management.

TL;DR

Angular’s Resource API and RxResource API simplify how developers handle asynchronous data retrieval and management by providing a reactive, declarative approach. These APIs come with built-in state management, automatic request cancellation, local data updates, and an easy refresh mechanism. They reduce boilerplate code and streamline handling of loading states, errors, and data.

👀 Let’s see it!

Before going into detail, here’s a comparison of implementations:

Example: Retrieving a list of todos with signals and effect vs. using the Resource API. The code is at the end of the article, with other options commented.

Retreiving todos with and without resource api image
Retrieving todos with and without resource api

🔎 Let’s analyze the code

--

--

FAM
FAM

Written by FAM

A passionate software engineer and Angular GDE. I love to learn, help & share ❤. Find more about me here: 🔗 www.fatimaamzil.com.

No responses yet