Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Angular

Structural Directives in Angular

Add/remove DOM with @if/@for (or *ngIf/*ngFor).

Structural Directives in Angular — a practical guide to Angular structural directives with clear examples you can reuse in real projects.

Angular Tutorial Series (27/119). Prefer one article? Read the complete Angular tutorial.

Short description

Track @for items with a track expression for performance.

Control flow

@if (user) {
  <p>{{ user.name }}</p>
} @else {
  <p>Guest</p>
}

@for (item of items; track item.id) {
  <li>{{ item.name }}</li>
}

Leave a reply

Your email address will not be published. Required fields are marked *