填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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.