moduleName.requires undocumented, poorly understood and used only by the Angular injector . The injector, in turn, is called at boot time (via ng-app or angular.bootstrap ) or creates a new injector with angular.injector .
After the application has loaded and the configuration / start phase has finished, new config / run blocks cannot be called. The same goes for moduleName.directive , moduleName.controller and other modular methods, all of which must be called before the application is loaded. Therefore, they are not suitable for defining a module asynchronously.
A recently defined execution unit can be called explicitly by creating an injector (and this means that a new instance of the application is being created):
var newApp = angular.injector(['app.main']);
This primary use is testing, and it has a limited application in production - the newly created application and its services cannot communicate with the downloaded application, since the service singletones are different.
There are several solutions for lazy loading in Angular, most fully ocLazyLoad .
source share