Grouping Application Features into Modules

Learn how to organize application features into modules.

Each Angular module represents a particular feature of an Angular application. The way these feature modules are added to the application depends on a business’s needs. In this section, we will investigate three different ways:

  • Adding modules in the main application module

  • Adding modules to another feature module

  • Grouping feature modules by type

In the following sections, we will explore each way in more detail.

Adding a module in the main module

We have already learned how to create a new Angular module for our application using the Angular CLI. Creating an Angular module does not make it automatically available to the application. It is our responsibility to register the new module with the rest of the application using the main application module:

  1. Open the app.module.ts file and add a new import statement to import ProductsModule on line 5:

Get hands-on with 1200+ tech skills courses.