October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

Angular NG8105: Fix “Missing `let` Keyword in an `*ngFor` Expression”

Fix NG8105 by declaring the loop variable with `let` in the `*ngFor` expression. Learn why it matters and how diagnostic settings and the @for migration relate.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular NG8105 means an *ngFor expression is missing the let declaration for its loop variable. Change *ngFor="item of items" to *ngFor="let item of items". The added keyword declares the template-local variable that represents each item.

What NG8105 means

Angular emits NG8105 when an expression used by *ngFor omits let. In the loop expression, let is required to declare the local variable; it is not optional wording. Without that declaration, a reference such as {{ item }} does not have the intended loop variable in scope. Angular’s NG8105 guidance describes this diagnostic.

As an Amazon Associate I earn from qualifying purchases.

How to fix the template

Add let before the item variable:

<!-- Incorrect -->
<div *ngFor="item of items">{{ item }}</div>

<!-- Correct -->
<div *ngFor="let item of items">{{ item }}</div>

The corrected expression declares item as a template-local variable and iterates over items. Keep the rest of the loop unchanged unless Angular reports a separate issue.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why the keyword is part of the syntax

The *ngFor form is shorthand for an embedded template. In the expanded structural-directive syntax, a local declaration such as let item corresponds to a template variable such as let-item. This is why omitting let is a syntax problem rather than a styling preference. Angular’s structural directives guide explains the shorthand and its expanded form.

NgFor renders a template for each item in an iterable. The directive can also expose loop context such as the index, and a trackBy function can define how items are associated with rendered DOM elements. Those features are separate from NG8105: first ensure the item variable is declared correctly. See the NgFor API for its documented context and behavior.

When Angular reports NG8105

NG8105 is an Angular extended diagnostic. Extended diagnostics require strictTemplates to be enabled; NG8105 has no additional requirement. Angular emits extended diagnostics as warnings by default, so a warning does not block compilation. You can configure diagnostic categories as warning, error, or suppress; an error fails compilation. Details are in Angular’s Extended Diagnostics overview and template type-checking guide.

Suppressing the diagnostic

If a project has a specific reason not to report this check, Angular documents a diagnostic-specific suppression in tsconfig.json:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "angularCompilerOptions": {
    "extendedDiagnostics": {
      "checks": {
        "missingNgForOfLet": "suppress"
      }
    }
  }
}

Suppression changes whether Angular reports the issue; it does not add the missing declaration or correct the template. For the ordinary case, repair the expression instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Should you migrate from *ngFor to @for?

Angular marks NgFor deprecated since v20.0 and recommends the @for block; removal is intended in a future major release. That is a separate maintenance decision, not the immediate NG8105 fix. Adding let corrects an existing *ngFor expression. Migrating to @for changes the loop syntax more broadly, so check the project’s Angular version and migration constraints before choosing that work.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.