If you're still using *ngIf, *ngFor, and *ngSwitch, Angular 19 just gave you a reason to upgrade your template game.
Angular now supports JavaScript-style control flow syntax directly in your templates:
@if (user) {
<p>Hello, {{ user.name }}!</p>
} @else {
<p>Please log in.</p>
}
@for (item of items; track item.id) {
<li>{{ item.name }}</li>
} @empty {
<li>No items found.</li>
}
@switch (status) {
@case ('success') { <p>Success!</p> }
@case ('error') { <p>Error!</p> }
@default { <p>Unknown</p> }
}
✅ More readable
✅ Less boilerplate
✅ Built-in @empty and real @else blocks
✅ IDE-friendly and intuitive
Want to see side-by-side comparisons with the old syntax?
👉 Read the full breakdown
Top comments (0)