October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan 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 desk3 min

How to Fix Angular NG0919: Circular Dependency Detected

Angular NG0919 signals a runtime cycle among components, directives, or pipes. Trace the import chain and remove the dependency that loops back.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular’s NG0919 means it detected a runtime circular dependency among components, directives, or pipes. Follow the imports from the types named in the error until a path returns to its starting point, then remove that runtime cycle—usually by extracting shared code, replacing a type-only import with import type, or restructuring the component relationships.

What NG0919 means

Angular describes NG0919 as a circular dependency between components, directives, or pipes. One file can import another, which eventually imports the first file again. The cycle may be direct—Component A imports Component B and B imports A—or indirect, such as Component A → Component B → Component C → Component A. Either form can prevent proper initialization.

The runtime message documented by Angular can begin Cannot read @Component metadata. Angular also notes that older versions might instead report Cannot read properties of undefined (reading 'ɵcmp'). The wording can vary by Angular version, so use the error code and referenced files to guide your diagnosis. Angular’s NG0919 reference provides the official description and examples.

How to find the import cycle

  1. Read the full runtime error. Note any component metadata and file references. These point to a useful starting place, but the cycle may include other files not named in the message.
  2. Trace imports through the source files. Follow each relevant component, directive, or pipe import into the next file. Keep going until you find a path back to a file already visited. Check intermediate files as well as direct imports.
  3. For a large TypeScript source tree, scan with Madge. From the project root, run madge --circular --extensions ts ./src to list circular imports. To create a graph, run madge --circular --extensions ts ./src --image graph.svg. These commands are suggested in the Angular NG0919 documentation. Use the output to locate the cycle; the repair is to remove the problematic runtime dependency.

How to break the cycle

Move shared functionality into a neutral file

If two components depend on the same helper, constant, or other shared logic, put it in a separate file that neither component imports back through the other. Then both can depend on that file without depending on each other. Keep the extracted module independent of both participants; otherwise the cycle may simply move.

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 type-only import when you need only a TypeScript type

If a reference exists solely to express a type and is not needed at runtime, use import type. Angular explains that type-only imports are erased at compile time and therefore do not add a runtime circular dependency. This is not a fix when the code actually needs the imported value at runtime.

Restructure the component hierarchy

If components import one another because their responsibilities or relationships are tangled, revise the design so one does not need a runtime reference back to the other. Extracting shared behavior or changing which component owns a responsibility can remove the dependency rather than hiding it.

Make sure the error is NG0919, not another Angular cycle diagnostic

Angular has other cycle-related errors, but they describe different phases and dependencies. Confirm the code before choosing a fix:

Error Where the cycle occurs What to investigate
NG0919 Runtime dependency among components, directives, or pipes. Trace the source import chain and remove the runtime cycle.
NG0200 Dependency injection: services directly or indirectly depend on themselves. Follow the service dependency path and refactor the relationships. Angular recommends restructuring first; events may replace direct dependencies where suitable, while lazy injection is a last resort. See the NG0200 troubleshooting guide.
NG3003 A separately classified compiler error: “Import Cycle Detected.” Use the compiler diagnostic and its context rather than assuming the runtime NG0919 repair path applies. See the NG3003 error reference.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When Angular DevTools can help

Angular DevTools’ Injector Tree visualizes injector hierarchy and resolution paths. Its documentation says the tool is available for Angular applications built with version 17 or higher. It is relevant when investigating injector behavior, particularly a DI issue such as NG0200; it does not replace tracing source imports to fix NG0919. Angular DevTools documentation describes the Injector Tree.

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.

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.