Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Structural Directives in Angular

Avatar for Eileen Chua Eileen Chua
October 04, 2022
13

Structural Directives in Angular

What does *ngIf, *ngFor, and *ngSwitch have in common? In this walk, we will be taking a deeper look into structural directives, and learn to create and use custom structural directives in our applications.

This talk was first presented at Angular Singapore's meetup on 4 October 2022.

Avatar for Eileen Chua

Eileen Chua

October 04, 2022
Tweet

Transcript

  1. Directives: Building Blocks of Angular Modifies functionality/behavior of DOM elements

    Component Directive with template (unlike the others) Attribute Set custom behavior or appearance Works with element Can be stacked Structural Add/remove elements in the DOM Works with template Can’t be stacked [ngClass], [ngStyle] *ngIf, *ngFor, *ngSwitch
  2. Where to go from here? • Learn more about attribute

    directives! • Implement your own directives • Learn to use context to pass data into structural directives (advanced)