Angular 2+: Modules vs Components

Component :

A component is one of the basic building blocks of an Angular app. An app can have more than one components. Component control views .They also communicate with other components and services to bring functionality to your app.

Modules :

Modules consist of one or more components. They do not control any html. Your modules declare which components can be used by components belonging to other modules, which classes will be injected by the dependency injector and which component gets bootstrapped. Modules allow you to manage your components to bring modularity to your app.

Realtime Example :

Consider your angular Application as a building. A building can have N number of apartments in it. An apartment is considered as a module. An Apartment can then have N number of rooms which correspond to the building blocks of an Angular application named components.

Now each apartment (Module)` will have rooms (Components), lifts (Services) to enable larger movement in and out the apartments, wires (Pipes) to transform around and make it useful in the apartments.

You will also have places like swimming pool, tennis court which are being shared by all building residents. So these can be considered as components inside Shared Module.

I think this will give clear idea of what is component and modules.

If I missed anything please add your comments ☺️