Angular v18 is Now Available!
On May 23rd, the release of Angular version 18 was announced, marking an important milestone in its evolution. Over the last three versions, many new features and improvements have been introduced.
Angular v18 is Now Available!
On May 23rd, the release of Angular version 18 was announced, marking an important milestone in its evolution. Over the last three versions, many new features and improvements have been introduced.
This time, the focus was on refining the work by graduating many new APIs to stable, addressing common developer requests, and experimentally launching one of the most anticipated roadmap projects: change detection without ZoneJS.
In addition, Angular is committed to investing the next 10 years in improving and promoting the use of the platform.
Here are some of the new features:
Control Flow Syntax is Now Stable
Control Flow Syntax is now stable! The flow control syntax introduced in Angular 17 is no longer in Developer Preview and can be used confidently. As it’s now the recommended way to write templates, you should consider using it in your applications. You can easily migrate your applications using the provided schematics.
Default Content in ng-content
Default content is now allowed within the ng-content tag. This logical extension will allow developers to include default content directly in the tag.
Forms events
The AbstractControl class (the base class for form controls, groups, arrays, and records) now has a new property called events.
This field is an observable that emits events when the control’s value, status, pristine state, or touched state changes. It also emits events when the form is reset or submitted.
SSR and replay events
It is now possible to log user interactions during the hydration phase and replay them once the application is fully loaded. As you may know, the hydration phase is when the server-rendered HTML transforms into a fully functional Angular application, with listeners attached to existing elements.
However, during this phase, the user may interact with the application, and these interactions are lost (if hydration is not fast enough).
To enable this feature, you can use the withReplayEvents() function (Developer preview) in your server-side rendering configuration:
Zoneless Applications
Angular v18 introduces a new way to trigger change detection. Instead of relying on ZoneJS to know when something might have changed, the framework can now schedule change detection itself.
To do this, a new scheduler has been added to the framework (called ChangeDetectionScheduler), and this scheduler is used internally to trigger change detection. This new scheduler is enabled by default in version 18, even if you are using ZoneJS. However, the goal is to gradually move away from ZoneJS and rely solely on this new scheduler.
Other New Features:
Defer syntax is stable
Signal proposal as Standard
Experimental zoneless change detection
Router and redirects (redirectTo)
HttpClientModule deprecated (provideHttpClient)
SSR and i18n
Angular CLI (v18)
ng dev (Alias for ng serve - Vite)
New project skeleton updates
On this occasion, Solcre team member Gustavo Rodriguez gave a talk about the topics covered in this announcement at the Angular MVD event held at Qubika.
For more information, visit the official Angular blog:
https://blog.angular.dev/angular-v18-is-now-available-e79d5ac0affe