2021-01-13 17:34:57 -08:00
@name Missing Reference Target
@category compiler
2021-01-19 21:17:25 -08:00
@videoUrl https://www.youtube.com/embed/fUSAg4kp2WQ
2021-01-13 17:34:57 -08:00
@shortDescription No directive found with export
@description
2022-03-10 08:48:09 -08:00
Angular can't find a directive with `{{ PLACEHOLDER }}` export name.
This is common with a missing import or a missing [`exportAs` ](api/core/Directive#exportAs ) on a directive.
2021-01-19 21:17:25 -08:00
<div class="alert is-helpful">
This is the compiler equivalent of a common runtime error [NG0301: Export Not Found ](errors/NG0301 ).
</div>
2021-01-13 17:34:57 -08:00
@debugging
Use the string name of the export not found to trace the templates or modules using this export.
2022-03-10 08:48:09 -08:00
Ensure that all dependencies are properly imported and declared in our Modules.
For example, if the export not found is `ngForm` , we will need to import `FormsModule` and declare it in our list of imports in `*.module.ts` to resolve the missing export error.
2021-01-13 17:34:57 -08:00
2022-03-10 08:48:09 -08:00
<code-example format="typescript" language="typescript">
2021-01-13 17:34:57 -08:00
2022-03-10 08:48:09 -08:00
import { FormsModule } from '@angular/forms';
@NgModule({
…
2021-01-13 17:34:57 -08:00
imports: [
FormsModule,
2022-03-10 08:48:09 -08:00
…
</code-example>
2021-01-13 17:34:57 -08:00
If you recently added an import, you will need to restart your server to see these changes.
2022-03-10 08:48:09 -08:00
<!-- links -->
<!-- external links -->
<!-- end links -->
@reviewed 2022-02-28