Angular 17 Will Update Your Templates Control Flow Automatically
Angular 17 reached the RC0 status after several next subversions.
One of the exciting features that will land in this version is the new way to handle control flow in the template.
For example like this:
<header-cmp />
@if showBody {
<body-cmp />
} @else if showSummary {
<summary-cmp />
} @else {
Nothing to see here...
}
<footer-cmp />
The new syntax decouples control flow from node level *ngIf and others, leaving Vue.js behind.
It’s also much clearer than React syntax that easily leads to curly mess.
The solution with @ syntax proposed by the community will be available pretty soon.
For those with big codebases there’s a good news.
Thanks to the fine work done by Jessica Janiuk, Angular 17 will contain a schematics to upgrade templates to the new syntax automatically.
The schematics is well written and tested, so it should work like a charm. As long as your templates don’t contain errors.