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