2017-09-19 47 views
-1

我試圖創建一個使用使用角/ CLI &收到以下錯誤組件:錯誤角CLI添加組件

Error: Could not find an NgModule for the new component. Use the skip-import option to skip importing components in NgModule. 
Could not find an NgModule for the new component. Use the skip-import option to skip importing components in NgModule 

回答

0

這是因爲新的SPA模板。我有同樣的問題,並通過安裝VS代碼的「Angular files」擴展來解決它。它從上下文菜單中生成所需的文件。然後你只需要在app.module.shared.ts中添加Component