@if
noun
say it: “AT IF” /æt ɪf/
Angular template syntax, @if, that shows a block only when a condition is true.
What does @if do?
@if shows a block of the template only when a condition is true. Add @else for the other case. It replaced the older *ngIf.
@if (user) {
<p>Welcome, {{ user.name }}</p>
} @else {
<a routerLink="/login">Log in</a>
}
In a sentence
- “@if (cart.length === 0) shows "Your cart is empty".”
Level: Apprentice · More Angular terms at this level
Updated