Luis Custodio bio photo

Luis Custodio

XP | Software Craftsperson

Email Twitter LinkedIn Github Stackoverflow

After using angular basics, it become important to understand better how exactly the modules are loaded and how to take advantage of this when planning to port the application to the new Angular2.0 or event moving angular 1.x to ES2015 modules.

As the documentation describes modules are a way to isolate behavior and application concerns.


Angular modules are divided in two straight forward blocks:

  • Configuration blocks: Provider (not instances)
  • Run blocks: instances (not Providers)

Creation / Retrieval

Important notion to avoid headaches!

angular.module('fooModule', [])

is completely different from


First one will create a module (and overwrite if the case), the last will retrieve the previously defined module (or throw error if not defined.)

Following this idea, the next post will be about the service $injector