Difference between component and module in Angular

Last Updated: August 13, 2021

When you develop Single Page Application (SPA) with Angular framework it is very important to know the difference between component and module.

In this article I am going to discuss this in detail

You can create the component with following command

 ng generate component product

The component is the basic building block in Angular application. You can have more than one component when you develop application. Component can control the view (html) in your app and it can communicate with other component and services.

So, when you create a component (for example product), it will create four files


You can create the module with following command

 ng g module products --routing

Module consists of one or more components. You are not going to control HTML with module. So what module does is , building blocks like component, directives, services etc put together

Module is used to grouped set of functionalities