DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

Async Reactivity with Resources in Angular: resource(), httpResource(), and rxResource()

Angular resources bring asynchronous work into signal-based code. Learn which API to choose and how reactive parameters, cancellation, lifecycle state, HTTP, SSR, routing, and testing fit together.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular resources connect asynchronous work to signals: reactive parameters decide what to request, a loader or stream performs the work, and resource signals expose the current value and lifecycle state. Use resource() for general promise-based work, httpResource for reactive HTTP reads using Angular’s HTTP stack, and rxResource() when the source is an Observable. Resources are designed for reads, not writes: Angular may cancel work when its inputs change.

What Angular resources do

Signals such as signal and computed are synchronous. A Resource gives signal-based code a way to represent asynchronous work while exposing its value and state through signals. Fetching server data is a common use, but resources can also represent other asynchronous operations. See Angular’s async reactivity with resources guide.

As an Amazon Associate I earn from qualifying purchases.

The central pattern is reactive input, asynchronous work, and reactive output. For example, a selected user ID can determine which user record to fetch; when the ID changes, the resource requests the corresponding record and its state signals update.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the resource API for the kind of work

Need API How it fits
General promise-based or one-result asynchronous work resource() Reactive parameters drive an asynchronous loader, and the result is exposed through resource signals. Angular resource guide.
An HTTP request using Angular HTTP features httpResource A reactive wrapper over HttpClient that uses its interceptors and testing support. It starts eagerly, unlike an HttpClient Observable, which starts when subscribed. Angular httpResource guide.
An Observable source or existing RxJS pipeline rxResource() Its stream function returns an Observable and can use reactive parameters. Angular RxResourceOptions API.
Values that continue arriving over time A resource streaming API or Observable-backed rxResource() Streaming is suited to ongoing updates; Angular gives WebSockets, server-sent events, and Firestore snapshot listeners as examples. A loader is for one-time asynchronous results. Angular resource guide.
A write or mutation HttpClient or another mutation-specific API Angular advises against resources for mutations because in-flight work may be cancelled when request inputs change or the resource is destroyed. Angular resource guide; Angular httpResource guide.

The current Angular httpResource API reference labels it stable since v22.0. Stability labels can change between Angular releases; check the API reference for the version installed in your project before relying on a version-specific label. Angular httpResource API.

How reactive parameters trigger work

The params function determines the request. Angular tracks the signals read in that function, much as it tracks dependencies in a computed signal. When the resulting parameters change, the loader runs again. A minimal resource() shape is:

const userResource = resource({
  params: () => ({ id: userId() }),
  loader: ({ params, abortSignal }) =>
    fetch(`/api/users/${params.id}`, { signal: abortSignal }).then(r => r.json()),
});

This example shows the API shape; adapt the URL, response handling, and types to your application. The loader receives the parameters, the previous status, and an AbortSignal. Passing the signal to cancellable work such as fetch lets that operation respond to cancellation. Angular documents the parameter and loader behavior in its resource guide.

Skip loading until required inputs exist

If a required input is not available yet, have params return undefined. The loader will not run and the resource is idle. Returning a defined object such as { id: undefined } does not express the same “no request” condition; use undefined when the intended behavior is to skip loading.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cancellation and stale requests

If the parameters change while a load is in progress, Angular aborts the outstanding operation. Pass the loader’s AbortSignal to operations that support cancellation. With httpResource, changing a signal dependency cancels a pending request before its replacement is sent. These behaviors are useful when a read follows changing UI state, because obsolete work need not remain active; they are also why resources are a poor fit for writes that must complete. Resource cancellation; httpResource cancellation.

Read values and render lifecycle states safely

Resource state is available through signals including value, hasValue, error, isLoading, and status. Angular documents these statuses:

  • idle: there is no valid request and the loader has not run.
  • loading: the resource is loading.
  • reloading: work is being reloaded while the previous value remains available.
  • resolved: the resource has resolved.
  • error: the operation failed.
  • local: the value was set locally.

Check hasValue() before reading value(). It checks for a value and narrows away undefined; importantly, reading value() in the error state throws at runtime. Use the state signals to choose whether the UI should show a loading indicator, render available data, or report an error. Angular resource guide; Angular httpResource guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use httpResource for reactive HTTP reads

Choose httpResource when a reactive HTTP read should go through Angular’s HttpClient stack. It supports interceptors and the same testing APIs as HttpClient. Because it starts requests eagerly, constructing or updating its reactive inputs can initiate a request without waiting for an Observable subscription. That differs from the usual HttpClient Observable flow. Angular httpResource guide.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Response formats and parsing

By default, httpResource parses JSON. Its .text(), .blob(), and .arrayBuffer() variants cover other common response types. A parse option can validate or transform the raw response; the parser’s output determines the resource value type. Angular’s guide demonstrates Zod and also notes Valibot as an option. Angular httpResource guide.

Use resources with Angular routing

The Router’s resources route configuration can accept a resource implementation such as resource(), rxResource(), or a custom resource. The routing guide describes concurrent execution across matched routes, non-blocking route activation, and reloading a resource without renavigation. For rxResource, the route resource uses stream rather than an Observable-returning loader. See Angular’s routing data-fetching guide.

Transfer resolved data during server rendering

During server rendering, a resource loader runs to produce the HTML; without transfer, the browser normally runs the loader again during hydration. Giving the resource a unique, identical id on server and client lets Angular place the resolved value in TransferState and initialize the browser resource as resolved. Do not use this approach for user-specific values if rendered HTML could be shared or cached: the serialized value is included in the page HTML. Angular resource guide.

Test httpResource with Angular’s HTTP testing APIs

The httpResource guide uses the same testing APIs as HttpClient, including provideHttpClientTesting and HttpTestingController, and demonstrates waiting for the resource value to propagate. A question about coordinating dependent resources appears in Angular GitHub issue #68808, “How to test an httpResource triggering an httpResource?”, opened May 20, 2026. It illustrates a concrete concern: controlling when individual resources load and waiting for them one at a time. For your tests, account for the eager request behavior and the fact that a dependent resource may not start until its reactive input is available. Angular httpResource testing guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.