Creating our first module
We would typically need a module if we wanted to encapsulate logic for managing products in our e-shop application.
You will need the source code of the Angular application we created in Chapter 5, Managing Complex Tasks with Services, to follow along with the rest of the chapter.
To create a new module in an Angular application, we use the ng generate command of the Angular CLI, passing the name of the module as a parameter:
ng generate module products
The preceding command will create a products folder inside the src\app folder of our Angular CLI workspace. The products folder is the container for Angular artifacts that contain functionality related to the products module.
Keeping all module artifacts inside the module's folder is good practice. It helps you visualize the functionality of a module at a glance and concentrate on that specific module during development. It is also helpful when you decide to make a refactor to your code and must move...