This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -127,14 +127,20 @@ function setupModuleLoader(window) {
127
127
* or `this` if called as a setter.
128
128
*
129
129
* @description
130
- * Additional info about this module
130
+ * Read and write custom information about this module.
131
131
* For example you could put the version of the module in here.
132
132
*
133
133
* ```js
134
134
* angular.module('myModule', []).info({ version: '1.0.0' });
135
135
* ```
136
136
*
137
- * You can retrieve this information during runtime via the
137
+ * The version could then be read back out by accessing the module elsewhere:
138
+ *
139
+ * ```
140
+ * var version = angular.module('myModule').info().version;
141
+ * ```
142
+ *
143
+ * You can also retrieve this information during runtime via the
138
144
* {@link $injector#modules `$injector.modules`} property:
139
145
*
140
146
* ```js
Original file line number Diff line number Diff line change @@ -179,6 +179,12 @@ describe('module loader', function() {
179
179
theModule . info ( 'some text' ) ;
180
180
} ) . toThrowMinErr ( 'ng' , 'aobj' ) ;
181
181
} ) ;
182
+
183
+ it ( 'should completely replace the previous info object' , function ( ) {
184
+ theModule . info ( { value : 'X' } ) ;
185
+ theModule . info ( { newValue : 'Y' } ) ;
186
+ expect ( theModule . info ( ) ) . toEqual ( { newValue : 'Y' } ) ;
187
+ } ) ;
182
188
} ) ;
183
189
} ) ;
184
190
} ) ;
You can’t perform that action at this time.
0 commit comments