|
5 | 5 | regInvokes = {}, |
6 | 6 | regConfigs = [], |
7 | 7 | modulesToLoad = [], |
8 | | - recordDeclarations = [], |
| 8 | + // modules to load from angular.module or other sources |
| 9 | + realModules = [], |
| 10 | + // real modules called from angular.module |
| 11 | + recordDeclarations = [], |
9 | 12 | broadcast = angular.noop, |
10 | 13 | runBlocks = {}, |
11 | 14 | justLoaded = []; |
|
167 | 170 | if (!angular.isString(moduleName)) { |
168 | 171 | moduleName = getModuleName(moduleName); |
169 | 172 | } |
170 | | - if (!moduleName || justLoaded.indexOf(moduleName) !== -1) { |
| 173 | + if (!moduleName || justLoaded.indexOf(moduleName) !== -1 || realModules.indexOf(moduleName) === -1) { |
171 | 174 | continue; |
172 | 175 | } |
173 | | - // new if not registered, and not a config name |
174 | | - var newModule = regModules.indexOf(moduleName) === -1 && !modules[moduleName]; |
| 176 | + // new if not registered |
| 177 | + var newModule = regModules.indexOf(moduleName) === -1; |
175 | 178 | moduleFn = ngModuleFct(moduleName); |
176 | 179 | if (newModule) { |
177 | | - // new module |
178 | 180 | regModules.push(moduleName); |
179 | 181 | _register(providers, moduleFn.requires, params); |
180 | 182 | } |
|
700 | 702 | angular.bootstrap = function (element, modules, config) { |
701 | 703 | // we use slice to make a clean copy |
702 | 704 | angular.forEach(modules.slice(), function (module) { |
703 | | - _addToLoadList(module, true); |
| 705 | + _addToLoadList(module, true, true); |
704 | 706 | }); |
705 | 707 | return bootstrapFct(element, modules, config); |
706 | 708 | }; |
707 | 709 |
|
708 | | - var _addToLoadList = function _addToLoadList(name, force) { |
| 710 | + var _addToLoadList = function _addToLoadList(name, force, real) { |
709 | 711 | if ((recordDeclarations.length > 0 || force) && angular.isString(name) && modulesToLoad.indexOf(name) === -1) { |
710 | 712 | modulesToLoad.push(name); |
| 713 | + if (real) { |
| 714 | + realModules.push(name); |
| 715 | + } |
711 | 716 | } |
712 | 717 | }; |
713 | 718 |
|
714 | 719 | var ngModuleFct = angular.module; |
715 | 720 | angular.module = function (name, requires, configFn) { |
716 | | - _addToLoadList(name); |
| 721 | + _addToLoadList(name, false, true); |
717 | 722 | return ngModuleFct(name, requires, configFn); |
718 | 723 | }; |
719 | 724 |
|
|
0 commit comments