How to generate Component in Angular
1 min readApr 10, 2021
command to generate component in angular
In this article, You will be going to know how you can generate components by executing a simple command in angular.
Generate a Component in Angular Project
Use the Angular CLI to generate a new component.
ng generate component test
Or
ng g c test
The above command will create a directory src/app/test
.
Inside the test directory, four files will be generated
- A CSS file for the component styles as
test.component.scss
- An HTML file for the component template as
test.component.html
- A TypeScript file as
test.component.ts
The command also adds the TestComponent
as a declaration in the @NgModule
decorator of the src/app/app.module.ts
file.
Conclusion
Here are some more topics of angular
How to use ngx Data Table in Angular Project
Which Angular Version I Am Using
How to Create Toastr in Angular Project