There are few cool features released by Angular at its 19.2 release.
Let's get started knowing it one by one
TypeScript 5.8 support
TypeScript 5.8 released on Feb 13, 2025. Angular Team worked day and night for 13 days and finally made Angular to support the latest typescript release on Feb 26, 2025.
Now Literals at String Interpolation
Traditionally concatenation operator (+) is being used to include text with an embedded variable in a template.
{{ 'Number of people who loves Angular' + peopleCount() }}
Angular 19.2 allows template literals to make string interpolation more readable and concise. Just add your string inside (`) backtick and wrap your variable using ${}
{{ `Number of people loves Angular ${peopleCount()}` }}
Experimental httpResource
Suppose if you want to call an API service everytime when an Id value changes, what would be the traditional approach? We would inject HttpClient service and calling the function getUser manually whenever the Id changes. Isn't?
`
@Injectable(providedIn: 'root')
export class UserService {
https = inject(HttpClient);
getUser(id: number): Observable<User> {
return this.https.get<User>(`https://api.example.com/users/${id}`)
`
Now, by the introduction of httpResource we don't need to worry about the manual calling.
`
const userResource = httpResource<User>({
method: 'GET',
url: () => https://api.example.com/users/${id}
});
`
Once the {id} value changes, the http request automatically refreshes.
Other enhancements
Support Default value in resource()
Before the resource is fully loaded, resource().value() remains in an unknown state, from 19.2 version, it is possible to specify a default value that will be used when the resource has not yet loaded.
Before 19.2 version
resource().value(); // returns undefined
After 19.2 version
resource({defaultValue: 'hello' }).value() //returns hello
Detect missing structural directive imports
Missing imports wouldn't trigger warning from compiler for custom structural directive, from 19.2 compiler will trigger the warning to help frustrated developers.
Support type set in form validators
Set objects did not work correctly with Validators such as Validators.required, Validators.maxLength and Validators.maxLength
With this update, it will work correctly.
const set = new Set([1,2,3]);
const formControl = new FormControl(set, [Validators.maxLength(10)]);
Summary
Angular team never disappoint us whether it is compatibility or enhancement. They understand the core of developers day to day problems and fix it on time.
Angular 19.2 provides full compatibility with Typescript 5.8, interactions with templates, http requests handling, form validators and resource management.
Top comments (0)