How to generate Angular component

In this post we will see how you can generate the Angular component with Angular CLI.

You can run the following command at your terminal

You will see following output in your terminal. This is the list of files generated when you generate the product-list component

Generated component has been located at src/app/product-list location and you can see four files. You have html file for the template, css files to write styles and component.ts file for you to write the functionality of the component

When you create the component with Angular CLI , components will be added to app.module.ts file. This file register all the component when the application is started

So you can see following code in src/app/app.component.ts file

Now you can write following code in your src\app\app.component.html file to show the product-list component