Suggest an editImprove this articleRefine the answer for “What is let- syntax in a template?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`let` syntax in a template** in Angular is used to declare local variables inside structural directives (`*ngFor`, `*ngIf`, `ng-template`). **Key point:** `let` allows creating local variables for convenient access to data and context inside directives and templates, without changing the component class.Shown above the full answer for quick recall.Answer (EN)ImageIn Angular, `let` **syntax in a template** is used to **declare local variables inside structural directives** (`*ngFor`, `*ngIf`, `ng-template`), to work with data or state at the template level. ## Main points 1. **In** `*ngFor` - creates a variable for the current iteration item: ```html <li *ngFor="let item of items">{{ item.name }}</li> ``` - `item` is a local variable representing the current element of the `items` array. 2. **Additional local variables** in `*ngFor`: ```html <li *ngFor="let item of items; let i = index; let isFirst = first"> {{ i }} - {{ item.name }} (First: {{ isFirst }}) </li> ``` - `i` is the element's index, `isFirst` is true for the first element. 3. **In** `ng-template` - allows passing values from the context: ```html <ng-template #tpl let-name="userName"> <p>{{ name }}</p> </ng-template> ``` - `let-name="userName"` declares a local variable `name` that takes its value from the `userName` context. In other words, `let` in a template is a way to **create local variables for convenient access to data and context inside directives and templates**, without changing the component class.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.