| 2873 | return wasInjectorCreated() ? workFn() : workFn; |
| 2874 | ///////////////////// |
| 2875 | function workFn() { |
| 2876 | if (currentSpec.$injector) { |
| 2877 | throw new Error('Injector already created, can not register a module!'); |
| 2878 | } else { |
| 2879 | var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); |
| 2880 | angular.forEach(moduleFns, function(module) { |
| 2881 | if (angular.isObject(module) && !angular.isArray(module)) { |
| 2882 | fn = ['$provide', function($provide) { |
| 2883 | angular.forEach(module, function(value, key) { |
| 2884 | $provide.value(key, value); |
| 2885 | }); |
| 2886 | }]; |
| 2887 | } else { |
| 2888 | fn = module; |
| 2889 | } |
| 2890 | if (currentSpec.$providerInjector) { |
| 2891 | currentSpec.$providerInjector.invoke(fn); |
| 2892 | } else { |
| 2893 | modules.push(fn); |
| 2894 | } |
| 2895 | }); |
| 2896 | } |
| 2897 | } |
| 2898 | }; |
| 2899 | |
| 2900 | module.$$beforeAllHook = (window.before || window.beforeAll); |