What is the resource API (and httpResource) in Angular, and how does it compare with using HttpClient and RxJS?

Angular HTTP, RxJS and state · Experienced

Model answer

The resource APIs bring async data into the signal world: a resource has a request that depends on signals and a loader, and it exposes signals such as value, status, error and isLoading, and reloads when its inputs change. httpResource does the same for HTTP calls.

They aim to make loading data and showing its state simpler than hand-written RxJS. They are newer and their stability has changed between versions, so check the Angular documentation for your version before relying on them, and keep HttpClient with RxJS for complex streams.

Tips

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions