MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / loadModules

Function loadModules

lib/test/angular/1.4.3/angular.js:4344–4390  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

4342 // Module Loading
4343 ////////////////////////////////////
4344 function loadModules(modulesToLoad) {
4345 var runBlocks = [], moduleFn;
4346 forEach(modulesToLoad, function(module) {
4347 if (loadedModules.get(module)) return;
4348 loadedModules.put(module, true);
4349
4350 function runInvokeQueue(queue) {
4351 var i, ii;
4352 for (i = 0, ii = queue.length; i < ii; i++) {
4353 var invokeArgs = queue[i],
4354 provider = providerInjector.get(invokeArgs[0]);
4355
4356 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
4357 }
4358 }
4359
4360 try {
4361 if (isString(module)) {
4362 moduleFn = angularModule(module);
4363 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
4364 runInvokeQueue(moduleFn._invokeQueue);
4365 runInvokeQueue(moduleFn._configBlocks);
4366 } else if (isFunction(module)) {
4367 runBlocks.push(providerInjector.invoke(module));
4368 } else if (isArray(module)) {
4369 runBlocks.push(providerInjector.invoke(module));
4370 } else {
4371 assertArgFn(module, 'module');
4372 }
4373 } catch (e) {
4374 if (isArray(module)) {
4375 module = module[module.length - 1];
4376 }
4377 if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
4378 // Safari & FF's stack traces don't contain error.message content
4379 // unlike those of Chrome and IE
4380 // So if stack doesn't contain message, we create a new string that contains both.
4381 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
4382 /* jshint -W022 */
4383 e = e.message + '\n' + e.stack;
4384 }
4385 throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
4386 module, e.stack || e.message || e);
4387 }
4388 });
4389 return runBlocks;
4390 }
4391
4392 ////////////////////////////////////
4393 // internal Injector

Callers 1

createInjectorFunction · 0.70

Calls 6

forEachFunction · 0.70
isStringFunction · 0.70
runInvokeQueueFunction · 0.70
isFunctionFunction · 0.70
assertArgFnFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected