angular 多路由模塊新建組件的方法

More than one module matches. Use skip-import option to skip importing the component into the closest module.app

     新增組件 ng g c  文件夾路徑/name --module=approuting2     //name 組件名稱   路由組件名稱approuting2    文件夾路徑根節點在app文件夾spa

  ng g c home --module=app即在 app.module.ts中生成component

  又如新增到指定路由當中:ng g c home --module=router/app-routing  //router當前路由模塊文件夾  app-routing路由文件名稱,router

  新建之後會生成以下所示,
blog

  

上圖顯示引入沒有問題,但通用的東西可能沒法在該組件中使用,因此可去app.module.ts中引入該組件註冊:ip

相關文章
相關標籤/搜索