@HostBinding and @HostListener: what do they do and what are they for?

A quick tip that helps me remember what they do –

HostBinding('value') myValue; is exactly the same as [value]="myValue"

And

HostListener('click') myClick(){ } is exactly the same as (click)="myClick()"


HostBinding and HostListener are written in directives
and the other ones (...) and [..] are written inside templates (of components).

Leave a Comment