Recall the method signature for angular.module. If the second parameter, requires is provided, then we are creating a new module instead of retrieving an existi
The second parameter is used to define the module's dependencies - i.e., a list of modules (module names, to be precise) that should be already loaded by the injector before the current module is loaded.
And here's how this param (stored in the module's requires property) is used: (injector.js/loadModules()):
var runBlocks = [], moduleFn, invokeQueue, i, ii;
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return; // skipping already loaded modules
loadedModules.put(module, true);
if (isString(module)) {
moduleFn = angularModule(module); // prepared module object
runBlocks = runBlocks.concat(loadModules(moduleFn.requires))
.concat(moduleFn._runBlocks);
// ...
}
// ...
}
return runBlocks;
As you see, this property can be used to set up a hierarchy of dependencies as well (when ModuleFoo depends on ModuleBar depending on ModuleBaz).