F:\samples>ng g c add-sample
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.

解决办法:
ng g c add-sample --module=app
原因:
项目中有多个模块(包含appModule , routingModule等),
所以需要选中要配置的app模块
本文介绍了解决 Angular 项目中因存在多个模块而引起的组件导入冲突问题的方法。通过指定模块参数,可以确保组件正确导入到目标模块,避免错误发生。
8037

被折叠的 条评论
为什么被折叠?



