(modulesToLoad)
| 4989 | // Module Loading |
| 4990 | //////////////////////////////////// |
| 4991 | function loadModules(modulesToLoad) { |
| 4992 | assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); |
| 4993 | var runBlocks = [], moduleFn; |
| 4994 | forEach(modulesToLoad, function(module) { |
| 4995 | if (loadedModules.get(module)) return; |
| 4996 | loadedModules.set(module, true); |
| 4997 | |
| 4998 | function runInvokeQueue(queue) { |
| 4999 | var i, ii; |
| 5000 | for (i = 0, ii = queue.length; i < ii; i++) { |
| 5001 | var invokeArgs = queue[i], |
| 5002 | provider = providerInjector.get(invokeArgs[0]); |
| 5003 | |
| 5004 | provider[invokeArgs[1]].apply(provider, invokeArgs[2]); |
| 5005 | } |
| 5006 | } |
| 5007 | |
| 5008 | try { |
| 5009 | if (isString(module)) { |
| 5010 | moduleFn = angularModule(module); |
| 5011 | instanceInjector.modules[module] = moduleFn; |
| 5012 | runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); |
| 5013 | runInvokeQueue(moduleFn._invokeQueue); |
| 5014 | runInvokeQueue(moduleFn._configBlocks); |
| 5015 | } else if (isFunction(module)) { |
| 5016 | runBlocks.push(providerInjector.invoke(module)); |
| 5017 | } else if (isArray(module)) { |
| 5018 | runBlocks.push(providerInjector.invoke(module)); |
| 5019 | } else { |
| 5020 | assertArgFn(module, 'module'); |
| 5021 | } |
| 5022 | } catch (e) { |
| 5023 | if (isArray(module)) { |
| 5024 | module = module[module.length - 1]; |
| 5025 | } |
| 5026 | if (e.message && e.stack && e.stack.indexOf(e.message) === -1) { |
| 5027 | // Safari & FF's stack traces don't contain error.message content |
| 5028 | // unlike those of Chrome and IE |
| 5029 | // So if stack doesn't contain message, we create a new string that contains both. |
| 5030 | // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. |
| 5031 | // eslint-disable-next-line no-ex-assign |
| 5032 | e = e.message + '\n' + e.stack; |
| 5033 | } |
| 5034 | throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}', |
| 5035 | module, e.stack || e.message || e); |
| 5036 | } |
| 5037 | }); |
| 5038 | return runBlocks; |
| 5039 | } |
| 5040 | |
| 5041 | //////////////////////////////////// |
| 5042 | // internal Injector |
no test coverage detected