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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Angular NG8023 means two or more components available in a template’s compilation scope match the same element. Angular cannot choose between them, so find the competing selectors—including selectors from imported libraries—and make the intended component the sole match.

What NG8023 means

NG8023 is an Angular compiler error. Angular describes it as: “Two or more components in the compilation scope match the same element in a template.” The conflict is between component selectors, not simply between arbitrary template elements. Angular’s NG8023 guidance explains the collision and the selector-focused fix.

For example, if two components use the selector comp, then a template element such as <comp></comp> matches both. Angular cannot associate two components with that one element, so the selector match is ambiguous.

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

How to find the conflicting components

  1. Start with the diagnostic. Note the element or selector identified by the NG8023 error and locate that element in the template.
  2. Search component declarations. Find the relevant @Component declarations and compare their selector values with the element. Check element, attribute, and other selector forms that could match it.
  3. Check the full compilation scope. Include components made available through the template’s imports, not just components declared in the same application area. If the conflict is not visible in your own code, inspect imported component libraries; Angular specifically notes Angular Material as an example to consider.
  4. Make the intended match unique. Adjust the competing selectors so only the intended component matches that element. Angular requires selectors to be sufficiently unique but does not prescribe one universal naming convention.

How selector collisions cause the error

Angular’s documented example has two imported components with attribute selectors [stroked-button] and [raised-button], both applied to the same <button>. Because both component selectors match that button, Angular reports NG8023. The relevant question is whether multiple component selectors match one element—not whether the selector strings look identical.

After identifying the collision, decide which component should own the element and change the selectors or their use so the other component no longer matches it. Avoid changing unrelated template code: the fix belongs at the selector overlap identified by the diagnostic.

How NG8023 differs from NG0300

NG8023 is the build-time compiler error for a component selector collision; Angular identifies runtime NG0300 as its runtime counterpart. Angular’s component acceptance tests demonstrate NG0300 with two components that both declare selector: 'comp' and a template containing <comp></comp>. The distinction is when the collision is reported: during compilation for NG8023, versus at runtime for NG0300.

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

Official error reference

Angular lists NG8023 among its compiler errors in the Error Encyclopedia. Its detailed explanation is available in Angular’s Japanese-localized NG8023 entry.

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.

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.