How can I inject an AngularJS module dependency without declaring it in the dependency array when the module is defined?
问题 Currently the only way that I know of to make module dependencies available is to specify them when a module is declared. e.g.: angular.module("myApp",["myDependentModule"]); This becomes a problem when the app gets large and modules have a lot of dependencies, libraries that must be loaded. If these libraries aren't required for any of the modules that the first page the user visits, it seems that those dependencies could be deferred to improve load time. Any advice would be appreciated. 回答1