| 2806 | return wasInjectorCreated() ? workFn() : workFn; |
| 2807 | ///////////////////// |
| 2808 | function workFn() { |
| 2809 | if (currentSpec.$injector) { |
| 2810 | throw new Error('Injector already created, can not register a module!'); |
| 2811 | } else { |
| 2812 | var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); |
| 2813 | angular.forEach(moduleFns, function(module) { |
| 2814 | if (angular.isObject(module) && !angular.isArray(module)) { |
| 2815 | fn = ['$provide', function($provide) { |
| 2816 | angular.forEach(module, function(value, key) { |
| 2817 | $provide.value(key, value); |
| 2818 | }); |
| 2819 | }]; |
| 2820 | } else { |
| 2821 | fn = module; |
| 2822 | } |
| 2823 | if (currentSpec.$providerInjector) { |
| 2824 | currentSpec.$providerInjector.invoke(fn); |
| 2825 | } else { |
| 2826 | modules.push(fn); |
| 2827 | } |
| 2828 | }); |
| 2829 | } |
| 2830 | } |
| 2831 | }; |
| 2832 | |
| 2833 | module.$$beforeAllHook = (window.before || window.beforeAll); |