What are Modules in Angular?
Explore how Angular uses NgModules to structure applications by grouping components, services, and other elements into cohesive modules. Understand the root module's role in bootstrapping and how modules import core framework functionality. This lesson helps you grasp the foundation for building organized and scalable Angular apps.
We'll cover the following...
Modules?
Modules are the glue that holds an application together. They are single TypeScript files that reference all the other files used within the application. They allow us, as Angular developers, to group the functionality of our application together.
From the AngularJS days, modules have been a core part of an Angular application. In Angular 2+, a new way of creating modules was introduced. The new @NgModules class was introduced as the new way to create modules of functionality in an application.
This new approach allows us as Angular developers to group together the elements of the module (the components, services, pipes, and directives) under a separate module. Then, we can group individual modules together to make a complete application. It’s a lot like how pieces of a puzzle are put together to make a complete picture.
Structure of a module
The NgModule class allows us to create a public ...