Introducing Angular Modules
Learn what Angular modules are and create your first Angular module.
We'll cover the following...
Angular modules are containers for a particular block of code that adheres to the same functionality. An Angular module is dedicated to an application domain, such as orders or customers for an e-shop application, or a user workflow, such as order checkout or user registration. Generally, it addresses a particular set of capabilities that an application can have.
The main advantage of the Angular module architecture is that it scales better and is easier to test. If we think of a module as a particular feature of an application, it allows us to organize our Angular application so that we can develop a particular piece of functionality independently of the others. It dramatically enhances team management in large organizations where each development team can work on a separate feature. Features can gradually be deployed, ensuring the seamless operation of our application.
Angular modules are different from JavaScript modules due to the context in which they operate. Previously, we learned that JavaScript modules help us organize our code in multiple files. On the other hand, Angular modules work in the context of the Angular framework. They play a significant role when the framework compiler converts an Angular application into JavaScript code. The role of an Angular module is to group all the artifacts of an Angular application that share a common functionality.
Previously, we learned that a typical Angular application contains at least a main module called AppModule
that is ...