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