(modulesToLoad)
| 5082 | // Module Loading |
| 5083 | //////////////////////////////////// |
| 5084 | function loadModules(modulesToLoad) { |
| 5085 | assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); |
| 5086 | var runBlocks = [], moduleFn; |
| 5087 | forEach(modulesToLoad, function(module) { |
| 5088 | if (loadedModules.get(module)) return; |
| 5089 | loadedModules.set(module, true); |
| 5090 | |
| 5091 | function runInvokeQueue(queue) { |
| 5092 | var i, ii; |
| 5093 | for (i = 0, ii = queue.length; i < ii; i++) { |
| 5094 | var invokeArgs = queue[i], |
| 5095 | provider = providerInjector.get(invokeArgs[0]); |
| 5096 | |
| 5097 | provider[invokeArgs[1]].apply(provider, invokeArgs[2]); |
| 5098 | } |
| 5099 | } |
| 5100 | |
| 5101 | try { |
| 5102 | if (isString(module)) { |
| 5103 | moduleFn = angularModule(module); |
| 5104 | instanceInjector.modules[module] = moduleFn; |
| 5105 | runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); |
| 5106 | runInvokeQueue(moduleFn._invokeQueue); |
| 5107 | runInvokeQueue(moduleFn._configBlocks); |
| 5108 | } else if (isFunction(module)) { |
| 5109 | runBlocks.push(providerInjector.invoke(module)); |
| 5110 | } else if (isArray(module)) { |
| 5111 | runBlocks.push(providerInjector.invoke(module)); |
| 5112 | } else { |
| 5113 | assertArgFn(module, 'module'); |
| 5114 | } |
| 5115 | } catch (e) { |
| 5116 | if (isArray(module)) { |
| 5117 | module = module[module.length - 1]; |
| 5118 | } |
| 5119 | if (e.message && e.stack && e.stack.indexOf(e.message) === -1) { |
| 5120 | // Safari & FF's stack traces don't contain error.message content |
| 5121 | // unlike those of Chrome and IE |
| 5122 | // So if stack doesn't contain message, we create a new string that contains both. |
| 5123 | // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. |
| 5124 | // eslint-disable-next-line no-ex-assign |
| 5125 | e = e.message + '\n' + e.stack; |
| 5126 | } |
| 5127 | throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}', |
| 5128 | module, e.stack || e.message || e); |
| 5129 | } |
| 5130 | }); |
| 5131 | return runBlocks; |
| 5132 | } |
| 5133 | |
| 5134 | //////////////////////////////////// |
| 5135 | // internal Injector |
no test coverage detected