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

NG0301: Export not found!
没有找到此导出!

说明

Description

Angular 找不到带有 {{ PLACEHOLDER }} 导出名称的指令。导出名称在指令装饰器的 exportAs 属性中指定。在模板中使用 FormsModule 或 Material 模块时,这很常见,因为你忘记了导入相应的模块

Angular can’t find a directive with {{ PLACEHOLDER }} export name. The export name is specified in the exportAs property of the directive decorator. This is common when using FormsModule or Material modules in templates, and you’ve forgotten to import the corresponding modules.

这是常见的编译器错误 NG8003:找不到带有 export 的指令的运行期等价物。

This is the runtime equivalent of a common compiler error NG8003: No directive found with export.


如何排除本错误

Debugging the error

根据此导出名来追踪使用了此导出的模板或模块。

Use the export name to trace the templates or modules using this export.

确保所有依赖项都已正确导入并在 NgModules 中声明。例如,如果未找到名为 ngForm 的导出,则需要导入 FormsModule,并把它添加到 *.module.ts 中的导入(imports)列表中来声明它,以解决该错误。

Ensure that all dependencies are properly imported and declared in your NgModules. For example, if the export not found is ngForm, we need to import FormsModule and declare it in the list of imports in *.module.ts to resolve the error.

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

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

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

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