Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk2 min

Angular NG8106: How to Fix “Suffix Not Supported”

Angular NG8106 flags unit suffixes on attribute bindings. Remove the suffix and put the intended unit in the bound value, or use a style binding when setting a style.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular NG8106 means a unit suffix such as .px, .%, or .em was added to an attr. binding. Those suffixes are supported for style bindings, not attribute bindings. Remove the suffix and include the intended unit in the bound attribute value—for example, change [attr.width.px]="5" to [attr.width]="'5px'".

What triggers NG8106?

The diagnostic is triggered by a unit suffix on an attribute binding, such as [attr.width.px]. Angular documents .px, .%, and .em as suffixes that have meaning for style bindings but not for attribute bindings. With attr.width, Angular is setting an attribute; the suffix does not convert the bound value into a unit-bearing value.

As an Amazon Associate I earn from qualifying purchases.

For example, this template produces NG8106:

<img [attr.width.px]="5" />

How do you fix NG8106?

Keep the attribute binding and put the complete intended value, including its unit, in the expression. Angular’s documented correction is:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<img [attr.width]="'5px'" />

The outer double quotes delimit the Angular expression; the inner single quotes make the expression evaluate to the string 5px. The attribute name no longer has a .px suffix.

Should you use an attribute binding or a style binding?

Choose according to what the template is intended to set. An attr. binding targets an HTML attribute, so provide that attribute’s intended value directly. A style binding targets a style value, which is the context where Angular supports the unit suffixes discussed in NG8106.

Intent Binding approach How to handle the unit
Set an attribute, such as width [attr.width] Include the intended unit in the assigned value where applicable, as in [attr.width]="'5px'".
Set a style value A style binding Angular supports .px, .%, and .em suffixes for style bindings.

These approaches are not interchangeable for every attribute or DOM property. Do not switch an attribute binding to a style binding merely to silence the diagnostic; use the target that matches the behavior you need.

When does Angular emit this diagnostic?

NG8106 is an Angular extended diagnostic. Extended diagnostics require strictTemplates to be enabled; NG8106 has no additional check-specific prerequisite. Angular’s extended diagnostics overview says they are warnings by default, but a project can configure them as warnings, errors, or suppressed.

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 can you suppress NG8106?

Correcting the binding is preferable when the template should set an attribute or style value. If the project intentionally needs to suppress this check, use the check key suffixNotSupported in tsconfig.json:

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

The key is suffixNotSupported, not NG8106. The overview also documents defaultCategory: setting it to error promotes otherwise-default warnings to errors. Angular may add or enable extended diagnostics in minor releases, so projects that make all extended diagnostics errors should review their configuration when upgrading.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.