Hello Geek, Good Morning. I hope you have a great weekend going. I wake up early today to write something about Angular.
I am going to post about how to create a component in Angular. That will be a good starter in your Angular learning. 🙂
I hope you have read the Part – 1 of this tutorial, if not then do not worry, read it here Angular Sample Application – Part 1
So, let’s start.
To create a component in Angular you need to use the following command.
ng generate component component-name-with-path
You can also use the following short command.
ng g c component-name-with-path
We will create the following three components and learn
So execute the following three commands.
- For header: ng g c components/header
- For home: ng g c components/home
- For footer: ng g c components/footer
This command will create a component in the components folder.
Now, we will learn how to do routing in Angular.