DEV Community

Cover image for Ng-News: Episode 22/46 - Angular 15
ng-news
ng-news

Posted on

Ng-News: Episode 22/46 - Angular 15

Angular 15 makes Standalone Component & APIs and the NgOptimizedImage directive generally available. Directive composition API increases the productivity for component authors... and much more.

Standalone Components & API

Angular 15 is out. With the introduction of the provideHttpClient function, it completes the "Standalone" story. We can now write our Angular applications without NgModules. The main benefits - at the moment - are fewer lines of code and simplification.

In version 14, Standalone Components and API were still in the status of developer preview. Now they are fully stable.

NgOptimizedImage

The same is true for the NgOptimizedImage directive, which brings best practices in terms of image handling.

Directive Composition API

A completely new feature is the Directive composition API. It allows us to apply multiple directives to a component or another directive without creating a separate wrapper component or something similar.

Be aware that these host-directives need to be standalone. We might see that the newer features will only be exclusively available for standalone components.

Functional RouterGuards, Interceptors, and Resolvers

It is also possible that we use functions instead of classes for our router guards, interceptors, and resolvers. Maybe not a huge addition, but it results in less boilerplate code.

Better Stack Trace

Another smaller improvement is that we get a better a stack trace in chromium-based browsers when an error happens.

Deprecations

Last but not least, there is a deprecation for certain values of the providedIn property in the @Injectable decorator. You cannot use the values any or an NgModule anymore. So just go with the value root.

Launch Event

To get more information, you can watch the Angular 15 launch event on YouTube, the official blog entry from Minko Gechev, and of course the release notes.

Blog Post

Release Notes

Top comments (0)