Angular Module – My Notes

Angular modules are a key part of any Angular application. An Angular module is a class with an NgModule decorator.

An Angular module’s purpose:

  • To organize the pieces of our application,
  • Arrange them into cohesive blocks of functionality,
  • Extend our application with capabilities from external libraries.

Angular modules library the environment for resolving the directives and pipes in our components templates.

Modules are a great way to selectively aggregate classes from other modules, and re-export them in a consolidated convenience module. BrowserModule, HttpModule and RouterModule are all examples.

An Angular module can be loaded eagerly when the application starts or it can be lazy loaded asynchronously by the router.

An Angular module declares each component, directive and pipe that it manages. Every component, directive and pipe we create belongs to an Angular module.
An Angular module bootstraps our root application component.

Defining the component needed to display our first template. An Angular module can export components, directives, pipes and even other Angular modules, making them available for other modules to import and use.

An Angular module imports other Angular modules. This brings in the export functionality from those imported modules.

An Angular module can register service providers with the Angular injector, making the services available to any class in the application.

We can think of Angular module as a box. Inside that box we declare each of our components. If those components need any functionality that functionality also needs to be defined within this box.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s