In this Angular article we will learn about Generating Component inside folder.
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.
Generating Component inside 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:
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!
I hope you like this article.:)
Also Read :
- Angular File Upload Example
- Angular Multiple File Upload Example
- How to Convert HTML to PDF in Angular Application?
- Angular Material Table example using mat-table
- Angular Material List Example
- Angular Material Card