NG8003 Angular Origin: On your device Angular 9+ Last updated 15 Oct 2026

Angular: NG8003: No directive found with exportAs 'ngForm' (template reference variable)

A template reference such as #f="ngForm" points at a directive Angular cannot find on that element — the module that provides it is not imported.

Exact message you may see No directive found with exportAsNo directive found with exportAs 'ngForm'No directive found with exportAs 'ngModel'Export of name 'ngForm' not found
Seen on: Angular TypeScript

Meaning

#ref="name" asks for the directive whose exportAs is that name. If FormsModule, ReactiveFormsModule or the Material module that exports it is not imported, there is no directive with that name. Fix the import, not the template.

Common causes

  • FormsModule missing for #f="ngForm" or #c="ngModel"
  • ReactiveFormsModule missing for formGroup references
  • Material directive module not imported (for example MatMenuModule for #menu="matMenu")
  • Directive not applied on that element (typo in its selector)
  • Standalone component forgot the directive in imports

⚡ Quick fix

  1. Import FormsModule (or the module/directive that provides the exportAs)
  2. Check that the directive's selector actually matches the element
  3. Open the library docs for the exact exportAs name

Detailed fix by platform

Angular

  1. Standalone: imports: [FormsModule]
  2. NgModule: add FormsModule to the imports of the module that declares the component

Code examples

Template reference with exportAs

html
<form #f="ngForm" (ngSubmit)="save(f.value)">   <!-- needs FormsModule -->
  <input name="email" ngModel required>
  <button [disabled]="f.invalid">Save</button>
</form>

How to diagnose

  1. Name — Which exportAs is requested?
  2. Imports — Is the providing module imported here?
  3. Element — Does the directive attach to this element?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Cannot find control with name — Angular: Error: Cannot find control with name: 'email' (reactive forms) (Angular)Cannot find control w…mat-form-field must contain a MatFormFieldControl — Angular Material: Error: mat-form-field must contain a MatFormFieldControl (Angular)mat-form-field must c…NG01050 — Angular: NG01050: formControlName must be used with a parent formGroup directive (Angular)NG01050NG01203 — Angular: NG01203: No value accessor for form control with name: 'x' (ControlValueAccessor missing) (Angular)NG01203NG01352 — Angular: NG01352: If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as 'standalone' (Angular)NG01352NG02200 — Angular: NG02200: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays (Angular)NG02200NG0301 — Angular: NG0301: Export of name 'x' not found! (template variable #x="exportAs") (Angular)NG0301NG8001 — Angular: NG8001: 'app-item' is not a known element — verify that it is included in the component's imports (Angular)NG8001NG8003

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.