Further reading

Directives
  • Angular templates are dynamic
  • Directives give instructions to Angular on how to render the templates to the page
  • A directive can be defined in Angular as a class with the @Directive decorator
  • A component is a special kind of directive with a template associated with it
  • Two other kinds of directives in Angular: Structural and Attribute
Structural Directives
  • Allows you to alter the layout by adding, removing and replacing elements in a page
  • Apply a structural directive to a host element in the DOM and its descendants
  • Common Structural Directives
    • NgIf <div *ngIf=“selectedDish”> . . . </div>
    • NgFor <md-list-item *ngFor="let dish of dishes">
    • NgSwitch