Module 04 of 10

Directives & Pipes

Lessons

About This Module

Components give you structure, but templates need logic and formatting to become useful. This module covers the tools Angular gives you to shape what appears on screen: control flow to decide what renders, directives to change how elements behave, and pipes to format data before the user sees it.

It starts with Angular's built-in control flow blocks: @if for conditional rendering and @for for looping over lists, including the required track expression. These replace the older *ngIf and *ngFor directives, need no imports, and @switch follows the same pattern. From there it covers attribute directives, which add behavior to existing elements, and the Directive Composition API for bundling directives into components. It also covers pipes: the built-in ones, custom ones with @Pipe, and the async pipe.

The Fireship video was recorded for an earlier Angular version, so it shows *ngIf and *ngFor where newer code uses the control flow blocks from the first two lessons, and NgModules where newer code uses standalone components. The ideas behind directives and pipes are the same. Watch the lessons in order, then continue on to Services & Dependency Injection.

Lessons

4 videos
01

Angular @if: The New Control Flow Syntax

Angular University's walkthrough of showing and hiding template content with @if, @else, and @else if, and why it replaces *ngIf.

02

Angular @for: The New Control Flow Syntax

Looping over lists with @for, including the required track expression and the @empty block, and how it compares to *ngFor.

03

Angular Components Beginner's Guide: Directives & Pipes

Fireship's guide again, this time for its chapters on directives and pipes: structural and attribute directives, building your own directive, built-in and custom pipes, and the async pipe.

04

Angular Directive Composition API: Host Directives

Build attribute directives for auto-focus, hover tracking, and disabling while loading, then compose them into a component with hostDirectives.