with the traditional @Input() decorator, one can use the ngChanges to do something if the value change. In this case, I’m using a component in the ng-bootstrap modal. The modal contains a form. when the item to edit is selected, it’s passed to the component that’s in the modal.
<code>@Input() inputVar!: SomeType;
ngOnChanges(changes: SimpleChanges): void {
const chInputVar = changes['inputVar'];
//Do something when the value changes...
}
</code>
<code>@Input() inputVar!: SomeType;
ngOnChanges(changes: SimpleChanges): void {
const chInputVar = changes['inputVar'];
//Do something when the value changes...
}
</code>
@Input() inputVar!: SomeType;
ngOnChanges(changes: SimpleChanges): void {
const chInputVar = changes['inputVar'];
//Do something when the value changes...
}
Now, I’d like to use the signal input.
<code>inputVar = input<SomeType>();
//How to act when the value changes?
</code>
<code>inputVar = input<SomeType>();
//How to act when the value changes?
</code>
inputVar = input<SomeType>();
//How to act when the value changes?