Episode 23/50: Zoneless without Signals, Roadmap, Signal Inputs

Описание к видео Episode 23/50: Zoneless without Signals, Roadmap, Signal Inputs

The Angular team published the project plan for the Signals/Reactivity roadmap, where we can see what tasks they are currently working on and more.

https://github.com/orgs/angular/proje...

The roadmap unveiled a huge surprise: Getting zoneless applications without migrating to Signals will be possible.

This is especially good news for existing applications requiring years to migrate to Signals.

A future zoneless application must work with ChangeDetectionStrategy set to OnPush. Until now, zone.js triggered the change detection upon DOM Events or asynchronous tasks. Without zone.js, which is zoneless, the markForCheck methods will trigger the Change Detection directly.

markForCheck is already automatically executed by handled DOM Events, the async pipe, and immutable changes in property binding. In all other cases, like asynchronous tasks, we must run markForCheck manually via the ChangeDetectorRef.

The alternative is to go directly with Signals.

Again, zoneless with OnPush requires a new scheduler, which is not available yet.

  / 1735083883153313799  

---

We can expect Angular 17.1 in mid-January. It will deliver Signal Inputs. They will replace the current @Input decorator with a simple function called input(). The resulting type is a Signal, which we can easily use in a computed or effect.

The input function expects a generic type or a default value. If the default value is unavailable, the resulting type will be a union type of undefined and the actual type. There is also a required, which removes the undefined type but would throw an error during runtime if the value is missing.

Signal Inputs will streamline the code. Instead of using ngOnChanges, a computed or effect is enough.

https://github.com/angular/angular/pu...

Комментарии

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