Course lesson

Replace Input and Output Decorators with signal-based APIs using Angular Migrations

Angular apps will benefit from using signal inputs and outputs as they offer a more declarative and reactive coding style.

Duration
7 min
Access
Included
Transcript
Retained from source evidence

Angular apps will benefit from using signal inputs and outputs as they offer a more declarative and reactive coding style.

Signal inputs enable components to directly react to changes in signals, making data flow within components more predictable and easier to manage.

Angular developers can either manually update their components to use signal inputs by adding the () syntax to input bindings in templates and using the Signal type for input properties, or they can utilize the automated migration schematic.

The ngxtension package offers a schematic (ng g ngxtension:convert-signal-inputs) that automatically converts existing input bindings and references to use signal inputs, streamlining the adoption of this feature.

This automatic conversion helps maintain consistency and reduces the potential for errors during the transition. The migration schematic also updates the components' templates to use the new signal inputs, which might necessitate minor manual adjustments for type narrowing in certain cases.