Sub topic 15
Experimental status and version differences
This chapter assumes you have read the earlier chapters. You should know resource, rxResource, httpResource, and how params and loader work. The API has changed between Angular releases, so code copied from older articles may not compile.
What "experimental" means here
Angular marks some APIs as experimental or developer preview. Such an API can change in a minor release without the usual deprecation period. The resource family has had this label in the releases that ship it. The label can change between releases, so check it for your version instead of relying on this chapter.
In practice this means:
- Pin your Angular version and read the release notes before upgrading.
- Keep resource calls in a few places, such as services, so a rename touches little code.
- Expect blog posts and AI-generated snippets to mix old and new names.
Renames to watch for
The table compares the first releases (Angular 19) with the shape used in this tutorial (Angular 20 and later).
| Item | Angular 19 | Angular 20 and later |
|---|---|---|
| Reactive input of `resource` | `request` | `params` |
| Loader argument | `{ request, abortSignal }` | `{ params, abortSignal }` |
| `rxResource` function | `loader` | `stream` |
| Status type | `ResourceStatus` enum | String union such as `'loading'` or `'resolved'` |
| `httpResource` | Added in 19.2 | Available, same experimental label |
Reading value() while the resource is in the error state also differs between releases. In newer releases it throws. Check hasValue() first, as the dependent-resource example did, or read error() before value().
The same resource in both shapes
An Angular 19 resource looks like this:
import { Component, resource, signal } from '@angular/core';
interface User {
id: number;
name: string;
}
@Component({
selector: 'app-user-v19',
template: `<p>{{ user.value()?.name }}</p>`,
})
export class UserV19Component {
readonly userId = signal(1);
readonly user = resource({
request: () => ({ id: this.userId() }),
loader: async ({ request, abortSignal }) => {
const res = await fetch(`/api/users/${request.id}`, { signal: abortSignal });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()) as User;
},
});
}After upgrading to Angular 20, two names change:
import { Component, resource, signal } from '@angular/core';
interface User {
id: number;
name: string;
}
@Component({
selector: 'app-user-v20',
template: `<p>{{ user.value()?.name }}</p>`,
})
export class UserV20Component {
readonly userId = signal(1);
readonly user = resource({
params: () => ({ id: this.userId() }),
loader: async ({ params, abortSignal }) => {
const res = await fetch(`/api/users/${params.id}`, { signal: abortSignal });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()) as User;
},
});
}The behavior stays the same. The resource re-runs when the signals read in the first function change, and a stale request is aborted.
Status checks that break across versions
Code that compares against the enum, such as ResourceStatus.Loading, stops compiling when the status becomes a string union. Prefer the boolean signals isLoading() and hasValue() and the error() signal. They read the same in both shapes and are less fragile than comparing status values.
How to check your own version
- Run
ng versionor read@angular/coreinpackage.json. - Open the API reference for
resourceon angular.dev and select your version. - Compare the option names and the stability label with your code.
- Let the TypeScript compiler help. A renamed option such as
requestshows up as an unknown property.
Exercise
After upgrading from Angular 19 to 20, your rxResource call fails to compile. It uses request and loader. Which two options do you rename, and what do you rename them to?
Show answer
Rename request to params, and rename the rxResource loader option to stream. The loader argument then reads { params } instead of { request }.