[英]Any advice on this angular problem? Mosh tutorial not working for me?
觀看https://youtu.be/k5E2AVpwsko並在添加課程部分的大致時間到了 1:35:00。 我得到以下錯誤。 編譯失敗。
../src/app/app.component.html:2:1 - 錯誤 NG8001:“課程”不是已知元素:
2
../src/app/app.component.ts:5:16
5 templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.
What am i missing? I tried debugging, but nothing. Any help is appreciated.
您尚未將課程組件聲明為應用程序模塊的一部分。 在聲明數組中,您需要提供它。 您也可以從終端的應用程序模塊目錄中嘗試 ng g 組件課程等 ng 命令,而不是手動創建它,然后自動將其添加到應用程序模塊。
您應該刪除應用程序組件並使用 ng generate 組件課程。它會自動將該組件添加到您的應用程序模塊中。 它既簡單又方便。 您還可以觀看 angular 組件的文檔,這對您的開發很有幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.