填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

NG8003: No directive found with export
没有找到带有导出的指令

说明

Description

Angular 找不到带有 {{ PLACEHOLDER }} 导出名称的指令。这通常是因为指令上缺少导入或缺少 exportAs

Angular can’t find a directive with {{ PLACEHOLDER }} export name. This is common with a missing import or a missing exportAson a directive.

这是常见运行时错误 NG0301:找不到导出的编译器等价物。

This is the compiler equivalent of a common runtime error NG0301: Export Not Found.


如何排除本错误

Debugging the error

使用找不到的导出字符串名称来跟踪使用此导出的模板或模块。

Use the string name of the export not found to trace the templates or modules using this export.

确保所有依赖项都已正确导入并在我们的模块中声明过。例如,如果未找到导出 ngForm,则需要导入 FormsModule,并把它声明在 *.module.ts 中的导入列表中,以解决这种缺失导出的错误。

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.

      
      import { FormsModule } from '@angular/forms';

@NgModule({
  ...
  imports: [
    FormsModule,
    
    

如果最近添加了导入,则需要重新启动服务器以查看这些更改。

If you recently added an import, you will need to restart your server to see these changes.