Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober 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 Now×
Skip to content
World desk2 min

Angular NG0301: Export Not Found — Meaning and Fixes

Angular NG0301 means a template requests a directive export that is unavailable in its context. Trace the name, check the directive and imports, and verify custom exportAs metadata.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular NG0301 means a template requests a directive by an export name that Angular cannot find in that template’s context. Find the exact name in the error, locate the template reference using it, then check that the directive is available there and exposes that name. For the common ngForm case, Angular’s documented fix is to import FormsModule in the relevant NgModule.

What does NG0301 mean?

A template can assign a name to a directive instance through a template reference, for example #form="ngForm". The name in quotation marks is an export name: the directive makes it available through its exportAs metadata. NG0301 means Angular cannot find a directive with the requested export name in that template’s context. It does not, by itself, diagnose a missing npm package.

Angular’s NG0301 error page describes the issue and gives ngForm as an example. The required import depends on the directive and library that provide the export; FormsModule is not a universal fix.

How to find and fix the missing export

  1. Read the full error. Note the exact export token Angular names, such as ngForm. Start with that name rather than installing or updating packages indiscriminately.
  2. Find where the template requests it. Search the relevant templates for the token, often in a reference such as #form="ngForm".
  3. Identify the directive that should provide it. Check which Angular directive or library is expected to expose that name.
  4. Check the imports for the template’s compilation context. Make sure the dependency providing the directive is imported where that template is compiled. For ngForm, Angular’s documented example is to add FormsModule to the relevant NgModule’s imports list.
  5. Check custom directive metadata. If the directive is yours, inspect its @Directive metadata and confirm its exportAs value matches the name in the template. The Angular Directive API reference documents exportAs.
  6. Restart the development server if needed. Angular notes that a restart may be necessary after adding an import if the error persists.

Is NG0301 the same as NG8003?

No. NG0301 is reported at runtime; NG8003, “Missing Reference Target,” is the compiler-time equivalent. Angular lists a missing import and a directive that does not provide the requested exportAs name among common causes of NG8003. If the error appears during compilation, follow the same steps: identify the referenced export, find the directive meant to provide it, and check its metadata and imports. See Angular’s NG8003 error page.

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.

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

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
Crashes, No Sound, or Screen Glitches?Free driver 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.