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

Function loadModules

lib/test/angular/1.6.7/angular.js:4971–5019  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

4969 // Module Loading
4970 ////////////////////////////////////
4971 function loadModules(modulesToLoad) {
4972 assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
4973 var runBlocks = [], moduleFn;
4974 forEach(modulesToLoad, function(module) {
4975 if (loadedModules.get(module)) return;
4976 loadedModules.set(module, true);
4977
4978 function runInvokeQueue(queue) {
4979 var i, ii;
4980 for (i = 0, ii = queue.length; i < ii; i++) {
4981 var invokeArgs = queue[i],
4982 provider = providerInjector.get(invokeArgs[0]);
4983
4984 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
4985 }
4986 }
4987
4988 try {
4989 if (isString(module)) {
4990 moduleFn = angularModule(module);
4991 instanceInjector.modules[module] = moduleFn;
4992 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
4993 runInvokeQueue(moduleFn._invokeQueue);
4994 runInvokeQueue(moduleFn._configBlocks);
4995 } else if (isFunction(module)) {
4996 runBlocks.push(providerInjector.invoke(module));
4997 } else if (isArray(module)) {
4998 runBlocks.push(providerInjector.invoke(module));
4999 } else {
5000 assertArgFn(module, 'module');
5001 }
5002 } catch (e) {
5003 if (isArray(module)) {
5004 module = module[module.length - 1];
5005 }
5006 if (e.message && e.stack && e.stack.indexOf(e.message) === -1) {
5007 // Safari & FF's stack traces don't contain error.message content
5008 // unlike those of Chrome and IE
5009 // So if stack doesn't contain message, we create a new string that contains both.
5010 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
5011 // eslint-disable-next-line no-ex-assign
5012 e = e.message + '\n' + e.stack;
5013 }
5014 throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}',
5015 module, e.stack || e.message || e);
5016 }
5017 });
5018 return runBlocks;
5019 }
5020
5021 ////////////////////////////////////
5022 // internal Injector

Callers 1

createInjectorFunction · 0.70

Calls 8

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

Tested by

no test coverage detected