In some of the scenarios, you may need to create component inside other folder.
You want to separate your components based on modules, at this situation you may need to create your component inside other folder.
When you use this Angular CLI command:
ng generate component first-component
It will create folder called first-component and will generate files inside of it as following.
And Now if you want to create component inside module1 folder, you can use the following command:
ng generate component module1/second-component
Now you can see that second-component is created inside module1 folder.
The same way you can create hierarchy
ng generate component main-module/sub-module/third-component
This will generate directory structure as follows:
That’s pretty much it 😄 Happy Coding!