Return to site

HostBinding and HostListener in Angular.Js

· HostBinding,HostListener,AngularJS,WebDevelopment,Webapplications
broken image

Given below are the description for HostListener and HostBinding in the official angular website.

HostListener - It declares a host listener. Decorator that declares a DOM event to listen for and provides a handler method to run when that event occurs.

HostBinding- Decorator that marks a DOM property as a host-binding property and supplies configuration metadata.Angular automatically checks host property bindings during change detection and if a binding changes it updates the host element of the directive. 

The role property declared with @HostBinding to host element

is binded in this example it listens to click event declared with @HostListener of the host element

.Read more