Episode 24/11: Angular 17.3

Описание к видео Episode 24/11: Angular 17.3

Angular 17.3 has arrived. It completes the new API, which provides features we require for "component communication". The old API used to be the property decorators @Input, @Output, @ViewChild, @ViewChildren, and @ContentChild, @ContentChildren.

The new API replaces those decorators with simple function calls, which return a signal —except the output function—and have a required method that enforces a certain type.

It is important to note that the old API and the decorators are still there; they aren't deprecated, and the new API - as it is already tradition - starts in "developer preview". That means features aren't buggy, but breaking changes between minor versions could happen.

Angular 17.3 added the output function, which returns you a new type OutputEmitterRef, which is an object literal containing an emit function that works in the same as the old EventEmitter.

The main difference is that it is not a BehaviorSubject under the hood. You might have to change something if you've been using next instead of emit.

The reason for that decoupling is the long-term plan to make RxJs optional. Some former episodes already covered that topic.

Nevertheless, you still have the possibility of mapping from an Observable to OutputEmitterRef. The function for that is outputFromObservable.

Other than that, we now have support for the brand-new TypeScript 5.4. The inject function also got an extension. Whenever a directive wanted to inject an attribute, it had to do it via the constructor. Now, the injection function is also able to do that.

For more information about the release, check out the ChangeLog, and the various blog postings and videos.

https://github.com/angular/angular/re...

https://www.angulararchitects.io/en/b...

https://blog.ninja-squad.com/2024/03/...

https://www.angularaddicts.com/p/what...

Комментарии

Информация по комментариям в разработке