Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS module lifecycle

Just googling "AngularJS Module Lifecycle". Could not find anything interesting. Can anybody on the planet explain me this.

I want to understand how exactly

angular.module("ui.bootstrap", [
    "ui.bootstrap.tpls", 
    "ui.bootstrap.accordion"
]);
  1. How exactly the dependencies gets resolved & in which order they gets loaded.?
  2. Does angular first calls run phase for ui.bootstrap then calls config and then loads dependencies?
  3. (When) Does angular also calls run and config phase for all dependent modules?
like image 275
Deepak Ingole Avatar asked Jul 20 '26 11:07

Deepak Ingole


1 Answers

From the documentation

  • The modules can be loaded in any order
  • Configuration blocks - get executed during the provider registrations and configuration phase. Only providers and constants can be injected into configuration blocks. This is to prevent accidental instantiation of services before they have been fully configured.
  • Run blocks - get executed after the injector is created and are used to kickstart the application. Only instances and constants can be injected into run blocks. This is to prevent further system configuration during application run time.

EDIT - update link

like image 114
Romski Avatar answered Jul 22 '26 01:07

Romski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!