Angular v15: Technical Guide to the Newest Features

November 30, 2022

The newest version of Angular, v15, is now available for use.

With the success of Angular 14, the Google-developed, TypeScript-based web application framework Angular 15 was released on November 16, 2022.

This version comes with a stable standalone components API, which means that Angular developers can build applications without needing NgModules. In addition, there is less boilerplate code and enhanced performance. The directive composition API has also been updated, and many more updates and features for developers.

Upgrading Angular can be daunting, but taking advantage of the new features and improvements is worth it. This blog post will guide you on why to upgrade angular 14 to 15. We will also highlight some new features and improvements in Angular 15.

Go on, Read.

Features of Angular 15

Angular v15.0.0 includes a plethora of new features that improve the development experience. So, let’s go over each feature in depth.

Stable Standalone APIs

The good news is that Angular v15 standalone components are now stable. As a result, the new standalone component feature is no longer in “Developer Preview” mode.

Angular 15 now allows developers to create Angular applications without the use of any modules. This is incredible news for inexperienced Angular developers looking to simplify their development methods and streamline their development experience.

Angular standalone components are now fully functioning in Angular Elements, router, HttpClient, and other applications. You may bootstrap an Angular application utilizing a single component with the help of standalone APIs.

Let’s look at an instance of how to use a standalone API from the official documentation:

Http with provideHttpClient

The new Angular 15 paradigm, where modules are optional, emphasizes HTTP support evolution and adaptation. It is possible to give the HttpClient using provideHttpClient(). HTTP interceptors are also evolving and can now be defined as functions.

API for Directive Composition

The directive composition API is another functionality of Angular 15.

The directive composition API allows developers to add directives to host elements, providing Angular with a powerful code reuse strategy. It does, however, only operate with standalone directives.

This feature was uplifted by the prevalent feature request on GitHub, which requested that directives be applied to a host element.

CLI has been optimized with enhancements.

Angular CLI supports standalone stable APIs. This allows you to create a standalone component via ng g component –standalone. On the other hand, the Angular team intends to optimize ng new output.

The first step is simplifying the configuration process by deleting test.ts, polyfills.ts, and environments. Furthermore, in the polyfills section, you can specify your polyfills directly in angular.json.

Enhanced Debugging Stack Traces

The enhancements in stack traces were challenging concerns shared by developers in an Angular team developer survey. That is why the Angular core team dug deeper into the issues with the debugging experience.

As a result, stack issues in Angular 15 are now more clear. The version now displays error messages focused on code rather than issues from third-party dependencies.

The router unwraps default imports.

The router will automatically unwrap default exports while lazy loading to simplify the router and reduce boilerplate. Here, for lazy loading, the router will look for the default export, and if it gets successful, it directly imports its lazy-file into the code.

Language Service Automatic Imports

The language service may now automatically import components you use in templates but haven’t added to standalone components or NgModules.

Dependency Injection

The providedIn: NgModule syntax no longer supports the @Injectable() decorator. As a result, you can utilize providedIn: “root.”

If providers must be limited to a single NgModule, use NgModule.providers. Furthermore, the providedIn: ‘any’ syntax is deprecated.

Forms

Forms now support utility functions such as isFormControl, isFormGroup, isFormRecord, and isFormArray.

Custom validators are highly useful when writing a custom validator because they contain AbstractControl in their signatures, but you frequently know that the validator you write is for a certain FormControl, FormGroup, etc.

CDK Listbox

The Component Dev Kit (CDK) includes a set of behavior primitives that can be used to create UI components. The CDK Listbox is a new primitive introduced in version 15, and it can be customized to fit your needs.

The @angular/CDK/Listbox module provides directives for creating unique Listbox interactions based on the WAI ARIA Listbox paradigm.

When you use @angular/CDK/Listbox, you receive all of the anticipated behaviors for an accessible experience, such as bidi layout, keyboard interaction, and attention management. Every directive applies to the host element and the ARIA roles associated with it.

Improvements to Experimental ESbuild Support

The experimental support for esbuild in ng build was included in v14 to allow for faster build times and to simplify the process.

It now includes experimental Sass, SVG templates, file replacement, and ng build —watchsupport in v15.

How to Setup Angular 15?

Angular provides a variety of Angular utilities. As a result, you only need to install Angular 15 using npm.

In the CLI, type the following command.

npm install —global @angular/cli

This command lets you quickly install the newest Angular CLI version on your system.

To Sum Up

Are you looking forward to implementing the Angular v14 to v15 upgrade? With the recent release of Angular v15, we can see that it’s jam-packed with many capabilities, delivering the most reliable independent APIs for development. The roadmap includes upgrades to the CLI, which might produce independent applications without the need for modules.

Angular 15 is shaping up to be the most promising Angular upgrade ever. Now is the time to migrate your project to Angular 15 with the assistance of an Angular developer from JS Panther. As a premier Angular development firm, we will assist you in implementing the most recent Angular Upgrade Services to meet your needs without losing any data or track record. So, what are you holding out for? Hire our Angular framework expert today.

Share On Facebook
Share On Twitter
Share On Linkedin

Our Latest Updates