Sub topic 15
Experimental status and version differences
This chapter assumes you have read the earlier chapters on resource, rxResource, and httpResource. It also assumes you know Angular signals and can run ng commands in a project. The earlier chapters used the current names (params, loader, stream). This chapter covers how those names changed, what "experimental" means for your code, and how to check the API in the Angular version you have installed.
What "experimental" means
The resource APIs arrived as experimental features and have been marked that way in the releases that ship them. An experimental API can change in a minor release. The Angular team does not promise the semver guarantees that apply to stable APIs. Names, option shapes, and return types can all move.
This is not a reason to avoid the API. It is a reason to:
- isolate resource usage behind a small number of services or components, so a rename touches few files;
- pin your Angular version and read the release notes before each upgrade;
- avoid copying snippets from articles without checking which version they target.
What changed between releases
The API shipped first in Angular 19 and was reworked in Angular 20. The table lists the changes you are most likely to meet. Verify the details against your own version, as described later in this chapter.
| Area | Angular 19 (first release) | Angular 20 and later |
|---|---|---|
| Reactive input of `resource` | `request: () => ...` | `params: () => ...` |
| Loader argument | `{ request, abortSignal, previous }` | `{ params, abortSignal, previous }` |
| `rxResource` function | `loader: ({ request }) => Observable` | `stream: ({ params }) => Observable` |
| Status type | `ResourceStatus` enum with members such as `ResourceStatus.Loading` | `ResourceStatus` string union such as `'loading'` |
| `httpResource` | Added in 19.2 as experimental | Still available, still experimental in the releases that ship it |
The status change matters in templates and tests. Older code compared against enum members. Newer code compares against string literals:
// Angular 19 style
import { ResourceStatus } from '@angular/core';
if (users.status() === ResourceStatus.Resolved) {
// ...
}
// Angular 20 style
if (users.status() === 'resolved') {
// ...
}The string values are 'idle', 'loading', 'reloading', 'resolved', 'error', and 'local'. They match the states from the chapter on status signals.
Migrating a resource from version 19 to 20
The change is mostly renaming. Here is the same resource in both styles.
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);
// Angular 19: `request` instead of `params`
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;
},
});
}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);
// Angular 20 and later: `params`
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;
},
});
}For rxResource, rename request to params and also rename loader to stream. The old name loader suggested a Promise, but the function returns an Observable, so the new name is more accurate.
import { Component, inject, signal } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { HttpClient } from '@angular/common/http';
interface User {
id: number;
name: string;
}
@Component({
selector: 'app-user-rx-v20',
template: `<p>{{ user.value()?.name }}</p>`,
})
export class UserRxV20Component {
private readonly http = inject(HttpClient);
readonly userId = signal(1);
// Angular 19 wrote: request: () => ..., loader: ({ request }) => ...
readonly user = rxResource({
params: () => ({ id: this.userId() }),
stream: ({ params }) => this.http.get<User>(`/api/users/${params.id}`),
});
}Check the API in your own project
Do not rely on memory or on this chapter alone. Use these checks, from fastest to most authoritative.
- Read the installed version. The
ng versioncommand prints the Angular core version. - Open the API reference on angular.dev for that version. Experimental symbols carry a label in the reference. Compare the option names listed for
resource()andrxResource()with the ones in your code. - Look at the type declarations that are actually installed. This is the check that cannot be out of date.
npx ng version
# Which option names does the installed resource() accept?
grep -n "params\|request" node_modules/@angular/core/index.d.ts | head -n 40
# Is the symbol still tagged experimental?
grep -n -B2 "export declare function resource" node_modules/@angular/core/index.d.tsThe exact layout of the declaration files can differ between releases. If the file path or the grep output looks different, search node_modules/@angular/core for function resource instead.
- Let the compiler tell you. After an upgrade, a renamed option shows up as a type error such as "Object literal may only specify known properties". Fix these errors before running the app.
- Run
ng update @angular/core @angular/cli. Migrations sometimes rename experimental APIs automatically, but do not count on it for experimental symbols. Review the diff.
Failure modes during an upgrade
These are the problems that show up in practice.
- Compile errors from renamed options. The most common cause is
requestandparamsmixing. Search the codebase forrequest:insideresource(andrxResource(calls. - Status comparisons that compile but never match. If the status type changes between an enum and string literals, TypeScript usually reports a type error. A comparison written against
anyor a loosely typed variable can silently stop matching. Prefer the typed helpers (isLoading(),hasValue(),error()) over raw status comparisons. They survive more changes. - Tests that import removed symbols. Tests that import
ResourceStatusas an enum fail to compile after the type changes. Update them together with the component code. - Behavior changes without a rename. Between experimental releases, details such as what a resource reports during
reload()or whenvalue()is read in an error state can change. Run the test suite and read the release notes' section on@angular/core. Do not assume that "compiles" means "behaves the same". - Third-party libraries. A library that wraps
resourcemay target one release. Check its peer dependency range before you upgrade Angular.
Decision criteria: adopt now or wait
| Situation | Suggested choice |
|---|---|
| New feature in an app you upgrade regularly | Use resources, behind a thin service layer |
| Library published to npm with a wide Angular peer range | Avoid exposing resource types in your public API |
| Long-lived app that upgrades once a year | Use resources, and budget time for renames at each upgrade |
| Code that needs request caching, retries, or mutations as built-in features | Check what the resource API offers in your version. Otherwise keep your current data layer |
The wrapper approach keeps the blast radius small:
import { Injectable, Signal, resource } from '@angular/core';
export interface User {
id: number;
name: string;
}
@Injectable({ providedIn: 'root' })
export class UserStore {
// Components depend on this method, not on resource() directly.
userById(id: Signal<number>) {
return resource({
params: () => ({ id: id() }),
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;
},
});
}
}If a later release renames params again, only UserStore changes. Components keep calling userById and reading value(), isLoading(), and error().
Exercise
A teammate pastes this code into a project on a current Angular release and gets a compile error: rxResource({ request: () => ({ id: this.id() }), loader: ({ request }) => this.http.get<User>(/api/users/${request.id}) }). Which three names must change, and which command or file would you use to confirm the correct names for the installed version?
Show answer
Change request to params, loader to stream, and the destructured request in the callback to params. Confirm with npx ng version plus the installed type declarations in node_modules/@angular/core (for example, search for function rxResource), or with the API reference for that version on angular.dev.
Exercise
Why is status() === 'resolved' risky to write in a library that must support both Angular 19 and Angular 20, and what is a safer alternative?
Show answer
In Angular 19 the status was an enum, so the comparison does not type-check there, and the enum import does not exist the same way in Angular 20. The safer alternative is to use the helper signals that exist in both, such as hasValue(), isLoading(), and error(), or to confine status checks to one wrapper that you update per release.