Follow-up · depth 5
How would you explain Built-in Control Flow @if @for @switch to a junior engineer?
How would you explain Built-in Control Flow @if @for @switch to a junior engineer?
Answers use simple, clear English.
Audio N/AQuick interview answer
Explain Built-in Control Flow @if @for @switch in one sentence, then a tiny example, then one “don’t do this” tip. Pros: Clearer templates; forces track for lists. Cons: Muscle memory of structural directives.
Detailed answer
Junior-friendly explanation of Built-in Control Flow @if @for @switch: Plain English: Pros: Clearer templates; forces track for lists. Cons: Muscle memory of structural directives. Tiny example: @for (item of items(); track item.id) { <li>{{ item.name }}</li> } One warning: Using index as track for reorderable lists.
Full explanation
Keep jargon low, then layer detail. New template syntax replaces *ngIf/*ngFor for many cases: @if, @for (with track), @switch. Better type narrowing and performance guidance via mandatory track.
Follow-up questions
Only answered follow-ups are shown — click to open with full answers
Parent context — Built-in Control Flow @if @for @switch
Pros: Clearer templates; forces track for lists. Cons: Muscle memory of structural directives.
View full parent question →