Edition 24/03: Angular 17.1

Edition 24/03: Angular 17.1

Angular 17.1 was released according to plan. Signal Inputs are its main feature.

As the name says, components get their input value as a Signal. Instead of the decorator @Input, we use a function called input. We can now react to changes in the form of computed, effect or just get the value directly from the Signal.

Three flavors are available:

  1. input with a default value resolves to a Signal of one particular type.
  2. input without a default value requires a generic type. The resulting type is a union type containing undefined.
  3. input.required expects a generic type as well but comes without a union type of undefined. input.required, which could throw a runtime error if you access the value of the signal before the component's initialization. That could be within the constructor.

Transformation functions for type mapping and parameter binding from the router are also possible.


For testing, the web test runner is available in an experimental mode. It will replace Karma, which runs Jasmine tests inside of the browser. There are no plans to replace Jasmine.

To use the Web Test Runner:

  1. install the dependency via npm install @web/test-runner –save-dev
  2. Replace the builder in the angular.json, path "architect.test.builder" from "@angular-devkit/build-angular:karma" to "@angular-devkit/build-angular:web-test-runner".
  3. Run "ng test"

More information in the commit's description:


There was some speculation about support for zoneless applications. We can disable zone.js and use a new scheduler to trigger the CD in markForCheck (which runs in the async pipe, handled DOM Events, immutable input property changes, or Signal changes).


To activate the new scheduler, add ɵprovideZonelessChangeDetection() to the providers property of the bootstrapApplication call.


At the moment, the new scheduler is an internal feature. Only use it if you want to live on the bleeding edge.


ngUpdate will not migrate to Input Signals. There is, though, a community migrator from Chau N Tran :


Tracy Lee

Helping organizations unlock real business value with AI enablement, modernization, and strategy. CEO @ This Dot Labs | 5x Microsoft MVP Award | 3x GitHub Star | 7x Google Developer Expert

1y

Awesome rundown!

Like
Reply
Alain Boudard

Architecte front Angular

1y

Awesome review of the latest version, great job Rainer !

Connie Leung

Google Developer Expert for Angular 🅰️ 🇭🇰 | NestJS | Web AI | Blogger | 🔊 Content Creator | Speaker | Software Architect

1y

Very detailed coverage of 17.1.0. Thanks Rainer

To view or add a comment, sign in

Others also viewed

Explore topics