What is Angular NgModule ?

-> NgModules help organize an application into cohesive blocks of functionality.
-> An NgModule is a class adorned with the @NgModule decorator function. @NgModule takes a metadata object that tells Angular how to compile and run module code. It identifies the module’s own components, directives, and pipes, making some of them public so external components can use them. @NgModule may add service providers to the application dependency injectors.
-> Modules are a great way to organize an application and extend it with capabilities from external libraries.
-> Many Angular libraries are modules (such as FormsModuleHttpModule, and RouterModule). Many third-party libraries are available as NgModules (such as Material Design, Ionic, AngularFire2).

-> NgModules consolidate components, directives, and pipes into cohesive blocks of functionality, each focused on a feature area, application business domain, workflow, or common collection of utilities.
-> Modules can also add services to the application. Such services might be internally developed, such as the application logger. Services can come from outside sources, such as the Angular router and Http client.

-> Every Angular app has at least one module class, the root module. You bootstrap that module to launch the application.

-> The root module is all you need in a simple application with a few components. As the app grows, you refactor the root module into feature modules that represent collections of related functionality. You then import these modules into the root module.

Leave a Reply

Your email address will not be published. Required fields are marked *