加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular-cli – ng生成子目录中的组件

发布时间:2020-12-17 07:19:18 所属栏目:安全 来源:网络整理
导读:我有以下目录结构 我想创建一个新页面,比如说,一个关于页面. 我想把它放在src / app / page / about / * 所以我尝试: ng generate component pages/about 但我得到这个错误: Error: More than one module matches. Use skip-import option to skip importi
我有以下目录结构

我想创建一个新页面,比如说,一个关于页面.
我想把它放在src / app / page / about / *

所以我尝试:

ng generate component pages/about

但我得到这个错误:

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

使用页面存储我的单独页面是一个好主意吗?
如何使用angular-cli在子目录中生成组件?

因为有2个模块(app.module.ts,shared.module.ts),所以CLI不知道在哪个模块中声明你的组件.要解决这个问题,你必须告诉CLI你要声明组件的模块.使用模块选项
ng generate component pages/about --module=app.module
// or
ng generate component pages/about --module=shared.module

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读