(modulesToLoad)
| 4494 | // Module Loading |
| 4495 | //////////////////////////////////// |
| 4496 | function loadModules(modulesToLoad) { |
| 4497 | assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); |
| 4498 | var runBlocks = [], moduleFn; |
| 4499 | forEach(modulesToLoad, |
| 4500 | function (module) { |
| 4501 | if (loadedModules.get(module)) return; |
| 4502 | loadedModules.put(module, true); |
| 4503 | |
| 4504 | function runInvokeQueue(queue) { |
| 4505 | var i, ii; |
| 4506 | for (i = 0, ii = queue.length; i < ii; i++) { |
| 4507 | var invokeArgs = queue[i], |
| 4508 | provider = providerInjector.get(invokeArgs[0]); |
| 4509 | |
| 4510 | provider[invokeArgs[1]].apply(provider, invokeArgs[2]); |
| 4511 | } |
| 4512 | } |
| 4513 | |
| 4514 | try { |
| 4515 | if (isString(module)) { |
| 4516 | moduleFn = angularModule(module); |
| 4517 | runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); |
| 4518 | runInvokeQueue(moduleFn._invokeQueue); |
| 4519 | runInvokeQueue(moduleFn._configBlocks); |
| 4520 | } else if (isFunction(module)) { |
| 4521 | runBlocks.push(providerInjector.invoke(module)); |
| 4522 | } else if (isArray(module)) { |
| 4523 | runBlocks.push(providerInjector.invoke(module)); |
| 4524 | } else { |
| 4525 | assertArgFn(module, 'module'); |
| 4526 | } |
| 4527 | } catch (e) { |
| 4528 | if (isArray(module)) { |
| 4529 | module = module[module.length - 1]; |
| 4530 | } |
| 4531 | if (e.message && e.stack && e.stack.indexOf(e.message) == -1) { |
| 4532 | // Safari & FF's stack traces don't contain error.message content |
| 4533 | // unlike those of Chrome and IE |
| 4534 | // So if stack doesn't contain message, we create a new string that contains both. |
| 4535 | // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. |
| 4536 | /* jshint -W022 */ |
| 4537 | e = e.message + '\n' + e.stack; |
| 4538 | } |
| 4539 | throw $injectorMinErr('modulerr', |
| 4540 | "Failed to instantiate module {0} due to:\n{1}", |
| 4541 | module, |
| 4542 | e.stack || e.message || e); |
| 4543 | } |
| 4544 | }); |
| 4545 | return runBlocks; |
| 4546 | } |
| 4547 | |
| 4548 | //////////////////////////////////// |
| 4549 | // internal Injector |
no test coverage detected