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

Function loadModules

test/angular/1.3/angular.js:4113–4159  ·  view source on GitHub ↗
(modulesToLoad)

Source from the content-addressed store, hash-verified

4111 // Module Loading
4112 ////////////////////////////////////
4113 function loadModules(modulesToLoad) {
4114 var runBlocks = [], moduleFn;
4115 forEach(modulesToLoad, function(module) {
4116 if (loadedModules.get(module)) return;
4117 loadedModules.put(module, true);
4118
4119 function runInvokeQueue(queue) {
4120 var i, ii;
4121 for (i = 0, ii = queue.length; i < ii; i++) {
4122 var invokeArgs = queue[i],
4123 provider = providerInjector.get(invokeArgs[0]);
4124
4125 provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
4126 }
4127 }
4128
4129 try {
4130 if (isString(module)) {
4131 moduleFn = angularModule(module);
4132 runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
4133 runInvokeQueue(moduleFn._invokeQueue);
4134 runInvokeQueue(moduleFn._configBlocks);
4135 } else if (isFunction(module)) {
4136 runBlocks.push(providerInjector.invoke(module));
4137 } else if (isArray(module)) {
4138 runBlocks.push(providerInjector.invoke(module));
4139 } else {
4140 assertArgFn(module, 'module');
4141 }
4142 } catch (e) {
4143 if (isArray(module)) {
4144 module = module[module.length - 1];
4145 }
4146 if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
4147 // Safari & FF's stack traces don't contain error.message content
4148 // unlike those of Chrome and IE
4149 // So if stack doesn't contain message, we create a new string that contains both.
4150 // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
4151 /* jshint -W022 */
4152 e = e.message + '\n' + e.stack;
4153 }
4154 throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
4155 module, e.stack || e.message || e);
4156 }
4157 });
4158 return runBlocks;
4159 }
4160
4161 ////////////////////////////////////
4162 // internal Injector

Callers 1

createInjectorFunction · 0.70

Calls 6

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

Tested by

no test coverage detected