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