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

CEO & Technologist @ This Dot Labs | Software Consulting | Google Developer Expert | Microsoft MVP | GitHub Star | RxJS Core Team | Driving business solutions and scaling tech teams

1 年

Awesome rundown!

回复
Alain Boudard

Architecte front Angular

1 年

Awesome review of the latest version, great job Rainer !

Connie Leung

Google Developer Expert for Angular ??? ???? | NestJS | Blogger | ?? Content Creator | Software Architect

1 年

Very detailed coverage of 17.1.0. Thanks Rainer

要查看或添加评论,请登录

Rainer Hahnekamp的更多文章

社区洞察

其他会员也浏览了