Structural Directives and Control Flow: @if, @for, @switch
Learn Structural Directives and Control Flow: @if, @for, @switch (Phase 4 · Directives and Pipes (Core), Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Built-in control flow blocks • Since Angular 17 the template uses control flow blocks : @if / @else if / @else , @for (with track , @empty ), @switch / @case / @default . They need no imports, are faster than the older directives and have better type narrowing. • @for requires a track expression (use a unique id): it lets Angular reuse DOM nodes when the list changes.