Your cart is currently empty!
Angular Getters and Setters on @Input() fields
Here is a handy cheat sheet… I kept forgetting the syntax of when an @input() decorator was used with a setter 🤦♂️
Getter
get allowDay(): boolean {
return this._allowDay;
}
Setter
@Input() set allowDay(value: boolean) {
this._allowDay = value;
this.updatePeriodTypes();
}
The cool thing is that when you set the value of the variable, you can trigger a function call as above 😎
by
Tags:
Leave a Reply