The idea behind using a setter is that whenever the @Input changes, it is setting a new value for this.message, which ends up triggering the setter and the extra code in it to notify of the update.

The getter is not used in that basic example but it’s very likely that a real-life component would need it to display that value in its template for instance.

Google Developer Expert in Angular, Consultant and Trainer at