The Angularjs module can be configured on its own before it is loaded and executed. We can apply different logical groups during the load phase of the app.
During the load phase of the module, Angularjs configures the module during provider registration and configuration. Throughout the ANGULARJS workflow, this phase is the only part that can be modified before the app is launched.
Angular.module (' myApp ', [])
. config (function ($provide) {
});
Use the syntax sugar of the config () function and execute it during the configuration phase. For example, when we create a service or instruction on top of a module:
Angular.module ('myApp', []). Factory ('MyFactory', function () {varService = {}; returnService; }). directive ('mydirective', function () {return{Template:'<button>click me</button>' } })
Angularjs will execute these auxiliary functions at compile time. They are functionally equivalent to the following notation:
Angular.module ('myApp', []). config (function ($provide, $compileProvider) {$provide. Factory ('MyFactory', function () {varService = {}; returnService; }); $compileProvider. Directive ('mydirective', function () {return{Template:'<button>click me</button>' }; });});
Angularjs executes them in the order in which these functions are written and registered.
AngularJS Module Loading