Inputs as signals
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Introduction
Angular signals provide a reactive way to handle state in applications. This new approach offers better performance optimization and cleaner code.
...
Signals can be used as inputs using the classic Input decorator until they are passed out of the developer preview.
Wiki Markupcode |
---|
@Component(...) class Component { @Input({ alias: 'example' }) set exampleValuevalue(value: unknown) { this.exampledemo.set(value); } exampledemo = signal<unknown | undefined>(undefined); } |
After Once Angular team release inputs as signals we can easily refactor our code to to
Wiki Markupcode |
---|
@Component(...) class Component { exampledemo = input<unknown | undefined>(undefined); } |
...
This approach allows us to use inputs as signals earlier.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------