mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
e41a52286f
This reverts commit 9bc15994ce.
PR Close #55326
1.0 KiB
1.0 KiB
@name Missing let keyword in an *ngFor expression
@description
This diagnostic is emitted when an expression used in *ngFor is missing the let keyword.
import {Component} from '@angular/core';
@Component({
// The let keyword is missing in the *ngFor expression.
template: <div *ngFor="item of items">{{ item }}</div>,
// …
})
class MyComponent {
items = [1, 2, 3];
}
How to resolve the problem
Add the missing let keyword.
import {Component} from '@angular/core';
@Component({
// The let keyword is now present in the *ngFor expression,
// no diagnostic messages are emitted in this case.
template: <div *ngFor="let item of items">{{ item }}</div>,
// …
})
class MyComponent {
items = [1, 2, 3];
}
@reviewed 2022-12-01