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 desk4 min

How to Fix Angular NG8001: Invalid Element

NG8001 means Angular cannot resolve a template element. Check its spelling and selector, then confirm the component is in the template’s standalone imports or NgModule scope.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NG8001 means Angular cannot resolve an element in a template. Check that the tag matches the component’s selector, then make sure the component is available in that template’s scope: add it to a standalone component’s imports, or declare and expose it through the relevant NgModule. Use a schema only when the tag is intentionally a browser custom element; a schema does not make a missing Angular component available.

What NG8001 means

Angular reports NG8001: Invalid Element when it cannot resolve a template tag as a valid HTML element or as an Angular component or directive matching that element. The diagnostic identifies the element Angular could not resolve. Find its use in the template, then check the tag and the component dependencies available to that template.

As an Amazon Associate I earn from qualifying purchases.

How do I fix NG8001: “x” is not a known element?

  1. Find the tag in the template. Use the element name in the diagnostic to locate where it appears. If it is used in more than one template, check each occurrence.
  2. Compare the tag with the selector. Open the component definition and compare its selector with the tag in the template. Fix spelling, punctuation, or case differences so the template uses the selector as declared. See Angular’s Component API.
  3. Check the template’s dependency scope. The component must be available to the component whose template uses it. Follow the standalone or NgModule path below.
  4. If it is a library component, verify the library’s exports and recent changes. Check documentation and exports for the versions installed in your project. If the spelling and scope are correct but the error persists, Angular also recommends restarting the development server.

Make an Angular component available to the template

The right fix depends on how the component using the tag is configured. A schema is not a substitute for either dependency path.

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

Standalone component

Add the component or other template dependency to the imports array in the standalone component that owns the template. For example, if AppComponent uses <app-alert>, import the component that declares that selector:

@Component({
  standalone: true,
  selector: 'app-root',
  imports: [AlertComponent],
  template: '<app-alert></app-alert>'
})
export class AppComponent {}

Use the actual component class and selector from your project. Angular describes standalone component dependencies in its advanced component configuration guide.

NgModule-based component

An NgModule-based component must be declared in an NgModule. If the component is used by a template belonging to a different module, the module that declares it must export it, and the consuming module must import the declaring module.

  1. Declare the component in its owning module’s declarations.
  2. Add it to that module’s exports if templates in another module need to use it.
  3. Import the owning module into the module that declares the consuming component.

If the component is only used by templates in its own module, it does not need to be exported for that use.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

When the tag is an intentional custom element

A browser custom element, sometimes called a Web Component, is not automatically an Angular component. If the unrecognized tag is intentionally a dash-case custom element, Angular’s CUSTOM_ELEMENTS_SCHEMA allows the documented dash-case non-Angular elements and properties during template validation. Add the schema to the relevant standalone component or NgModule configuration, as appropriate for the project’s Angular version.

Schema allowance only addresses Angular’s template validation. The browser still needs an implementation registered for the custom tag; for example, a custom element class is registered through the browser’s customElements.define() API. Angular Elements can turn an Angular component into a custom element; see Angular’s Custom Elements guide.

When creating a custom element from an Angular component, avoid using the Angular component’s own selector as the custom-element tag. Angular warns that this can result in two component instances on one DOM element.

Why not use NO_ERRORS_SCHEMA?

NO_ERRORS_SCHEMA is much broader: it accepts any property on any element. Angular’s API documentation says its use is generally discouraged because it prevents useful validation and may hide real template errors. It can make a misspelled tag or property stop producing a diagnostic without fixing the underlying problem.

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 CUSTOM_ELEMENTS_SCHEMA only when the tag really is an intentional custom element and its names fit the schema’s documented dash-case scope. For an Angular component, correct the selector or dependency scope instead.

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

Choose the fix based on what the tag represents

What the tag is What to check or change What the change does
Angular component in a standalone template Add its component class to the consuming component’s imports. Makes that dependency available to the template.
Angular component in an NgModule-based template Declare it in an NgModule; if another module consumes it, export it from the owning module and import that module in the consumer. Makes the component available through the NgModule scope.
Intentionally custom browser element Use CUSTOM_ELEMENTS_SCHEMA for the documented dash-case names and properties, and ensure the browser-side element is registered. Allows Angular template validation and, separately, supplies the element implementation at runtime.
Unknown tag or broad template-validation problem Do not use NO_ERRORS_SCHEMA as a blanket workaround; identify the tag or property and correct its source. Preserves useful Angular template diagnostics.

If the error remains

  • Confirm the error points to the template you edited and that the spelling matches the selector exactly.
  • For a standalone template, check the imports of the component that owns that template, not just imports elsewhere in the application.
  • For NgModules, trace the full declaration, export, and import relationship between the component and the consuming template.
  • For a library dependency, verify that the installed library version exports the component and that its current usage instructions match your installed Angular version.
  • Restart the development server after checking these causes if the diagnostic persists.

Angular’s documentation describes general guidance; project-specific behavior can depend on the Angular and library versions in use. The standalone migration guide covers an incremental migration path, but migrating an application is not required to fix NG8001.

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
PC Slower Than It Used to Be?Free scan - under a minute

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.