@@ -184,6 +184,28 @@ function annotate(fn, strictDi, name) {
184
184
* As an array of injection names, where the last item in the array is the function to call.
185
185
*/
186
186
187
+ /**
188
+ * @ngdoc property
189
+ * @name $injector#modules
190
+ * @type {Object }
191
+ * @description
192
+ * A hash containing all the modules that have been loaded into the
193
+ * $injector.
194
+ *
195
+ * You can use this property to find out information about a module via the
196
+ * {@link angular.Module#info `myModule.info(...)`} method.
197
+ *
198
+ * For example:
199
+ *
200
+ * ```
201
+ * var info = $injector.modules['ngAnimate'].info();
202
+ * ```
203
+ *
204
+ * **Do not use this property to attempt to modify the modules after the application
205
+ * has been bootstrapped.**
206
+ */
207
+
208
+
187
209
/**
188
210
* @ngdoc method
189
211
* @name $injector#get
@@ -677,6 +699,7 @@ function createInjector(modulesToLoad, strictDi) {
677
699
instanceInjector = protoInstanceInjector ;
678
700
679
701
providerCache [ '$injector' + providerSuffix ] = { $get : valueFn ( protoInstanceInjector ) } ;
702
+ instanceInjector . modules = createMap ( ) ;
680
703
var runBlocks = loadModules ( modulesToLoad ) ;
681
704
instanceInjector = protoInstanceInjector . get ( '$injector' ) ;
682
705
instanceInjector . strictDi = strictDi ;
@@ -772,6 +795,7 @@ function createInjector(modulesToLoad, strictDi) {
772
795
try {
773
796
if ( isString ( module ) ) {
774
797
moduleFn = angularModule ( module ) ;
798
+ instanceInjector . modules [ module ] = moduleFn ;
775
799
runBlocks = runBlocks . concat ( loadModules ( moduleFn . requires ) ) . concat ( moduleFn . _runBlocks ) ;
776
800
runInvokeQueue ( moduleFn . _invokeQueue ) ;
777
801
runInvokeQueue ( moduleFn . _configBlocks ) ;
0 commit comments