angular cli 1.4+;-在内部模块中创建组件
我的结构如下:angular cli 1.4+;-在内部模块中创建组件,angular,angular-cli,Angular,Angular Cli,我的结构如下: -AppModule --AdminModule ---HomepageModule 如何创建组件HomepageModule组件 我试过: ng g c admin/homepage/my-new-component ng g c admin/homepage/my-new-component --module homepage 我得到以下错误: Error: More than one module matches. Use skip-import optio
-AppModule
--AdminModule
---HomepageModule
如何创建组件HomepageModule组件
我试过:
ng g c admin/homepage/my-new-component
ng g c admin/homepage/my-new-component --module homepage
我得到以下错误:
Error: More than one module matches. Use skip-import option to skip importing the component into the closes
t module.
More than one module matches. Use skip-import option to skip importing the component into the closest modul
e.
有什么想法吗?正如警告所说,这是因为您有多个模块 您可以通过指定要将组件导入的模块的名称来解决此问题 比如说
ng generate component componentName --module=app.module
可能重复的您看过我试过的吗?因为它是相同的,所以您可以转到模块的文件夹,然后运行命令
ng g c my new component
,它将在模块中创建