4

Is there information about a Module's lifecycle. Currently the lifecycle of Components inside Angular is well documented and we have hook methods like ngOnInit(), ngDoCheck(), etc.

Do we have similar lifecycle hooks for Angular Modules? Where can I read something about this?

David Walschots
  • 10,733
  • 5
  • 33
  • 53
Hivaga
  • 1,548
  • 2
  • 12
  • 23

1 Answers1

0

Here is simple and effective explanation of NgModule

NgModules configure the injector and the compiler and help organize related things together.

NgModule metadata does the following:

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

  2. Declares which components, directives, and pipes belong to the module.

  3. Makes some of those components, directives, and pipes public so that other module's component templates can use them.

  4. Imports other modules with the components, directives, and pipes that components in the current module need.

  5. Provides services that the other application components can use.

  6. 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.

Read this article it will clear the all fundamental of Angular NgModules

References

Angular NgModules article link

Manoher Kumar
  • 229
  • 3
  • 10
  • Thank you for the reply but I was talking about lifecycle hooks not about general purpose of the modules. The hook methods are points in time and Angular is controlling the triggering, this will mean that for Example the injector for the certain module have been already created, and other dependencies as you described (components, directives, and pipes ... ) have been mapped/registered inside the injector. – Hivaga Mar 13 '18 at 15:25