Creating our first module
When creating a new Angular application, the first step is to define the different features our application needs. We should remember that each one should make sense on its own in isolation from the others. Once we’ve defined the required features, we will create a module for each. Each module will then be filled with the Angular artifacts that shape the feature it represents. Always remember the principles of encapsulation and reusability when defining your feature set.
If we wanted to create an e-shop application, we would typically need a module to manage the stock of our products. To create a new module in an Angular application, we use the
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 workspace. The
products folder is the container for Angular artifacts...