What are Modules in Angular?

Let's explore what modules are in Angular and how we can start an Angular application.

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.

Get hands-on with 1200+ tech skills courses.