Slide 1

Slide 1 text

ngIndia

Slide 2

Slide 2 text

Nishu Goel Software Engineer, IBM | Udemy Author |Community Developer @DcoustaWilson

Slide 3

Slide 3 text

@HostBinding() & @HostListener() @DcoustaWilson

Slide 4

Slide 4 text

ng-India www.ng-ind.com @DcoustaWilson

Slide 5

Slide 5 text

Check out: https://medium.com/@nishu0505/pre-requisites-for-my-talk-at-ngindia-f2b9adbe3d2e @DcoustaWilson

Slide 6

Slide 6 text

Directives? Really? Then what are components? The most basic building blocks of Angular @DcoustaWilson

Slide 7

Slide 7 text

Directives Component Structural Attribute (Self-contained directives) Directives with a template To change layout *ngIf *ngFor Change appearance or behavior @DcoustaWilson

Slide 8

Slide 8 text

CUSTOM ATTRIBUTE DIRECTIVE ng generate directive directive-name @DcoustaWilson

Slide 9

Slide 9 text

Steps to create Custom Attribute directives • Create Directive from the CLI • Inject services ElementRef and Renderer • Register inside the module • Use your Directives @DcoustaWilson

Slide 10

Slide 10 text

Host Element? @DcoustaWilson

Slide 11

Slide 11 text

@HostListener() @DcoustaWilson

Slide 12

Slide 12 text

@HostBinding() @DcoustaWilson

Slide 13

Slide 13 text

Thank You! PLAY AROUND WITH HOST BINDING & HOST LISTENER here on Stackblitz: https://stackblitz.com/edit/ngindia