Showing posts with label Generate component in Angular. Show all posts
Showing posts with label Generate component in Angular. Show all posts

Monday, 23 November 2020

How to generate component and define routings in Angular

November 23, 2020 0

 


Things we learned so far

How to set up environment

          How to create Angular project

 

Today we will understand how you can create component using Angular CLI and how you can define routing to each component.

You can run below command to generate the component using Angular CLI

CD <<folder where you want to have the component>> 

Run ng g c <<component name>>

   

ng g c <<component name>>

Angular CLI will create for files and also update the app.module.ts file by adding new entry to the import section.

Next we will create the component for home page.