How to generate angular components using CLI

Using Angular CLI we can quickly generate model class structure. Before that make sure you have

  1. npm
  2. angular CLI

preinstalled on your system. For better understanding of angular project structure I suggest the following post

Install CLI

If you already have the angular CLI installed , skip this step

npm install @angular/cli


Angular Components are building blocks of angular projects. It can be a product list component, a submission form etc .We can easily generate components using CLI and it will generate all necessary templates , style files for us.

Generate component

Use the following command to generate component from the project root

ng g c component-name  // say productList

Don’t forget to visit the source code page

Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.