| 3141 | return wasInjectorCreated() ? workFn() : workFn; |
| 3142 | ///////////////////// |
| 3143 | function workFn() { |
| 3144 | if (currentSpec.$injector) { |
| 3145 | throw new Error('Injector already created, can not register a module!'); |
| 3146 | } else { |
| 3147 | var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); |
| 3148 | angular.forEach(moduleFns, function(module) { |
| 3149 | if (angular.isObject(module) && !angular.isArray(module)) { |
| 3150 | fn = ['$provide', function($provide) { |
| 3151 | angular.forEach(module, function(value, key) { |
| 3152 | $provide.value(key, value); |
| 3153 | }); |
| 3154 | }]; |
| 3155 | } else { |
| 3156 | fn = module; |
| 3157 | } |
| 3158 | if (currentSpec.$providerInjector) { |
| 3159 | currentSpec.$providerInjector.invoke(fn); |
| 3160 | } else { |
| 3161 | modules.push(fn); |
| 3162 | } |
| 3163 | }); |
| 3164 | } |
| 3165 | } |
| 3166 | }; |
| 3167 | |
| 3168 | module.$$beforeAllHook = (window.before || window.beforeAll); |