October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober 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 NG8115: What “Uninvoked Track Function” Means and How to Fix It

Fix NG8115 by calling the function in your Angular @for track expression with the current item, then ensure it returns a suitable tracking key.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NG8115 means an Angular @for block refers to a tracking function without calling it. Pass the current loop item to that function—such as track trackByName(item)—so the expression returns a tracking key. Angular’s extended diagnostics require strictTemplates to report the warning.

What NG8115 means

In an @for block, Angular evaluates the track expression to associate collection items with their rendered DOM views. The expression should produce a key for the current item. If it names a function but omits the call, Angular receives the function reference rather than the key returned by that function. That is the misuse NG8115 identifies. See Angular’s NG8115 documentation.

As an Amazon Associate I earn from qualifying purchases.

For example, this expression names a function but does not invoke it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@for (item of items; track trackByName) {
  <li>{{ item.name }}</li>
}

Call the function with the current item instead:

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

How to fix the warning

  1. Find the @for expression identified in the compiler diagnostic.

  2. If its track expression names a function intended to calculate a key, invoke it with the loop variable. For example, change track trackByName to track trackByName(item).

  3. Check that the function returns a suitable key for each item. A unique, stable property such as item.id is often appropriate when items may be added, removed, or reordered. The key must distinguish items in the collection and reflect their identity for the updates your collection supports.

  4. Rebuild or run the project’s usual compiler check and confirm the NG8115 warning is gone. If you expect Angular to report the diagnostic but do not see it, check that strictTemplates is enabled.

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

Choose a tracking key that fits the collection

Invoking the function addresses NG8115, but it does not guarantee that the returned key is a good one. Angular uses tracking keys to connect items to rendered views and make the necessary DOM changes when a collection changes. A stable unique property helps Angular identify the same item across insertions, removals, and moves. Angular’s @for API documentation recommends a unique property for changing collections; $index is a straightforward option when the collection is static.

Configuration, severity, and suppression

NG8115 is an extended diagnostic. Angular requires strictTemplates for extended diagnostics, and NG8115 has no additional configuration prerequisite. Extended diagnostics are warnings by default and do not block compilation; a project can set an individual diagnostic to warning, error, or suppress. Setting it to error makes compilation fail when Angular emits it. Details are in Angular’s Extended Diagnostics guide.

If there is a specific reason to hide NG8115, configure its targeted suppression in the project’s TypeScript configuration:

{
  "angularCompilerOptions": {
    "extendedDiagnostics": {
      "checks": {
        "uninvokedTrackFunction": "suppress"
      }
    }
  }
}

Suppression hides the diagnostic rather than correcting the expression. Calling the function and returning an appropriate key is the normal fix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How this differs from legacy *ngFor

NG8115 is about the track expression in the newer @for template block. Legacy *ngFor uses a trackBy directive input, which accepts a function that returns a tracking key. These are different syntaxes: do not put trackBy in an @for block or treat @for’s track expression as the legacy directive input. Angular marks NgFor deprecated since v20.0 and directs users to @for.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.