Web
Analytics
@HostBinder and @HostListner Example in angular 2|4|5|6|7 - Tutorial

For Consultation : +91 9887575540

Stay Connected :

@HostBinder and @HostListner Example in angular 2|4|5|6|7

@Hostbinder and @Hostlistner are used to define custom directives using @Hostbinding and javascript events using @HostListner. So let me demonstrate it with an simple example.

Step1: Create new custom directive by following terminal command

ng g d mydirective

Step2. Add Following code into newly created directive

Step 3:  Add Following code into app.component.html

 

 

Select your currency