Angular 19.2: New features
- What's coming?
- Major new features
- httpResource (experimental)
- Support for TypeScript 5.8
- support default value in resource() and rxResource() https://github.com/angular/angular/pull/59655
- Form validators support for Set (https://github.com/angular/angular/pull/45793)
- How to update to Angular@next?
Official list of changes: https://github.com/angular/angular/releases/tag/19.2.0
Release date: 2025-02-26
Here is a list of what can be useful in the daily activity of a developer.
Compiler improvement and bug fixes are not included.
If you want to test the new features you need the next version of Angular. For an existing project you can upgrade using ng update @angular/cli @angular/core --next
What's coming?
Node version: no change (yet), ^18.19.1 || ^20.11.1
Typescript version: added support for 5.8
Yarn version: no change (yet), >=1.22.4 <2
Changes:
Major new features
In a Live Q/A (https://www.youtube.com/watch?v=Gf2c24-knBU) the Angular Team said that for 18.2 httpResource is one of the main new features.
httpResource (experimental)
From the Angular feature description:
httpResource is a new frontend to the HttpClient infrastructure. It declares a dependency on an HTTP endpoint. The request to be made can be reactive, updating in response to signals for the URL, method, or otherwise. The response is returned as an instance of HttpResource, a WritableResource with some additional signals which represent parts of the HTTP response metadata (status, headers, etc).
Support for TypeScript 5.8
The support is for TypeScript 5.8 Beta, at the moment. Here you can see what is new with this release:
https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/
support default value in resource() and rxResource() https://github.com/angular/angular/pull/59655
https://next.angular.dev/api/core/resource# and https://next.angular.dev/api/core/rxjs-interop/rxResource
The default value will be returned when the resource is still loading, or it is in an error state.
Example:
export function resource<T, R>(
options: ResourceOptions<T, R> & {defaultValue: NoInfer<T>},
): ResourceRef<T>;
const res = resource({
request,
loader: async ({request}) => {
if (request === 2) {
throw new Error('err');
}
return ['data'];
},
defaultValue: DEFAULT
});
Form validators support for Set (https://github.com/angular/angular/pull/45793)
Validators.required
, Validators.minLength
and Validators.maxLength
didn't work with sets because these have a 'size' and not a 'length' property.
The change allows to validate sets.
This PR comes from an ex-colleague at SBB in Switzerland, kudos. It tooks almost 3 years to get it approved.
How to update to Angular@next?
In this post I explain how to update your local version to Angular@next