Purpose This skill provides comprehensive guidance on Angular 20's built-in control flow syntax, which introduces new template syntax (@if, @for, @switch, @defer) that replaces structural directives with better performance, type safety, and developer experience.
| Syntax error with @ blocks | Ensure Angular 20+ and update compiler | | @for without track error | Always add track expression to @for | | @defer not lazy loading | Check bundle config and verify component is in separate chunk | | Type errors with @if | Use as alias for type narrowing |
| @empty not showing | Ensure collection signal returns empty array, not undefined |
Sintassi del flusso di controllo integrata di Angular 20 (@if, @for, @switch, @defer) per la programmazione di modelli moderni. Da utilizzare durante la scrittura di modelli con rendering condizionale, loop, istruzioni switch o componenti a caricamento lento. Sostituisce *ngIf, *ngFor, *ngSwitch con una nuova sintassi del blocco per prestazioni migliori e indipendenza dai tipi. Fonte: 7spade/black-tortoise.