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]; }
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]; }
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/extended-diagnostics/NG8105