When I try to create a component in the angular cli, it's showing me this error. How do I get rid of it ?
Error: More than one module matches. Use skip-import option to skip importing the component into the closest module.
I'm using angular cli version: 1.4.1
Use the skip-import option to skip importing the component into the closest module or use the module option to specify a module.
So now, you need to follow some simple steps to use multiple modules in an Angular application. Create a simple application using Angular CLI. If you are going to use Angular for the first time, click here. I am going to create an application which contains three modules: App, Employee, Admin, Home.
Typically module is a cohesive group of code which is integrated with the other modules to run your Angular apps. A module exports some classes, function and values from its code. The Component is a fundamental block of Angular and multiple components will make up your application.
Specify the module using the --module parameter. For example, if the main module is app.module.ts, run this:
ng g c new-component --module app
Or if you are in an other directory then
ng g c component-name --module ../
Try This: It is working for me
ng generate component componentName --module=app.module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With