Group 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.
Add 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:
- Open the
app.module.ts
file and add a newimport
statement to importProductsModule
:import { NgModule } from '@angular/core&apos...