I saw on one youtube video that he is making getter and setter for a property in the App Component.
private number: number = 23;
get counter() {
return this.number;
}
set counter(value) {
this.number = value;
}
increment() {
this.counter++;
}
decrement() {
this.counter--;
}
Why would we make something like this when we still can access the private and the public property in the HTML.
{{ number }}