Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

ngIndia - HostBinding() and HostListener()

Nishu Goel
February 23, 2019

ngIndia - HostBinding() and HostListener()

Directives in Angular help us to attach a specified behavior to the DOM. We can also create custom attribute directives and apply them on DOM elements. We can also capture the events and properties of the host element using HostBinding() and HostListener().

Nishu Goel

February 23, 2019
Tweet

More Decks by Nishu Goel

Other Decks in Programming

Transcript

  1. Directives Component Structural Attribute (Self-contained directives) Directives with a template

    To change layout *ngIf *ngFor Change appearance or behavior @DcoustaWilson
  2. Steps to create Custom Attribute directives • Create Directive from

    the CLI • Inject services ElementRef and Renderer • Register inside the module • Use your Directives @DcoustaWilson
  3. Thank You! PLAY AROUND WITH HOST BINDING & HOST LISTENER

    here on Stackblitz: https://stackblitz.com/edit/ngindia