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

NG8108: `ngSkipHydration` Should Be a Static Attribute in Angular

NG8108 flags a dynamic ngSkipHydration template attribute. Use a static attribute or conditionally render separate component branches; skipping hydration re-renders that subtree on the client.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NG8108 means Angular cannot determine statically whether a component should skip hydration because ngSkipHydration has a dynamic template value. Use the empty attribute or the literal value "true". If skipping should depend on application state, conditionally render a component branch with the static attribute instead of binding the attribute itself.

What NG8108 means

NG8108, named skipHydrationNotStatic, is an Angular extended diagnostic for a ngSkipHydration template attribute that is not statically analyzable. Angular needs to know at compile time whether that component should be hydrated. A value that looks like a template expression does not provide the required static value. See Angular’s NG8108 diagnostic documentation.

As an Amazon Associate I earn from qualifying purchases.

Extended diagnostics flag template patterns that may lead to unintended behavior. NG8108 is emitted when strictTemplates is enabled; see the Extended Diagnostics overview for the broader configuration context.

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.

Use a static attribute in the template

For an unconditional opt-out, put the attribute directly on the component host. Either of these forms is valid:

<user-viewer ngSkipHydration />
<user-viewer ngSkipHydration="true" />

Keep the special attribute static. For example, ngSkipHydration="hasUser" does not express a compile-time static value and can trigger NG8108.

Make the choice conditional by rendering a branch

If application state determines whether the component should skip hydration, put the static attribute on only the branch that needs it. Render an alternative branch without the attribute when it should hydrate. Angular’s diagnostic page demonstrates this approach with *ngIf and an ng-template; use the control-flow syntax supported by your application’s Angular version.

<user-viewer *ngIf="skipThisComponent; else hydratedViewer" ngSkipHydration />
<ng-template #hydratedViewer>
  <user-viewer />
</ng-template>

The condition controls which component branch is rendered; it does not turn ngSkipHydration into a dynamic attribute.

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

Put it on a component host, not an ordinary element

ngSkipHydration is valid only on a component host node. Adding it to an ordinary DOM element such as a div causes NG0504. Remove the attribute from the ordinary element or move it to the component host.

Angular’s hydration guide also documents a component host configuration form: host: {ngSkipHydration: 'true'}. This is a host-level mechanism, distinct from dynamically binding the special attribute in template markup.

Understand the cost before skipping hydration

Skipping hydration applies to the component and its children. Angular destroys that server-rendered region and renders it again on the client, as though hydration were not enabled for that subtree. This can restore client rendering for a component that is incompatible with hydration, but the subtree no longer receives hydration’s benefits.

Angular treats this as a workaround, not a routine optimization. Its hydration guide states: “Components that break hydration should be considered bugs that need to be fixed.” Prefer correcting the hydration-breaking pattern when possible, and avoid putting ngSkipHydration on the root application component because that effectively disables hydration for the application.

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

Configure or suppress the diagnostic

Extended diagnostics require strictTemplates. NG8108 can be configured under angularCompilerOptions.extendedDiagnostics.checks.skipHydrationNotStatic; Angular’s diagnostic page demonstrates suppress as a way to disable the check. Suppression hides the warning—it does not make a dynamic attribute value statically analyzable—so correcting the template is generally the more direct fix.

Angular compiler behavior can change. For version-specific details, use the documentation for the Angular major version installed in your project.

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.