|
13 | 13 |
|
14 | 14 | * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
|
15 | 15 | * {@link angular.module}. The `ng` module must be explicitly added.
|
| 16 | + * @param {boolean=} strictDi Disallow argument name annotation inference. Defaults to false. |
16 | 17 | * @returns {injector} Injector object. See {@link auto.$injector $injector}.
|
17 | 18 | *
|
18 | 19 | * @example
|
@@ -159,7 +160,8 @@ function annotate(fn, strictDi, name) {
|
159 | 160 | *
|
160 | 161 | * In JavaScript calling `toString()` on a function returns the function definition. The definition
|
161 | 162 | * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with
|
162 |
| - * minification, and obfuscation tools since these tools change the argument names. |
| 163 | + * minification, and obfuscation tools since these tools change the argument names. This method of |
| 164 | + * discovering annotations is disallowed when the injector is in strict mode. |
163 | 165 | *
|
164 | 166 | * ## `$inject` Annotation
|
165 | 167 | * By adding an `$inject` property onto a function the injection parameters can be specified.
|
@@ -244,6 +246,8 @@ function annotate(fn, strictDi, name) {
|
244 | 246 | * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
|
245 | 247 | * ```
|
246 | 248 | *
|
| 249 | + * You can disallow this method by using strict injection mode. |
| 250 | + * |
247 | 251 | * This method does not work with code minification / obfuscation. For this reason the following
|
248 | 252 | * annotation strategies are supported.
|
249 | 253 | *
|
@@ -296,6 +300,8 @@ function annotate(fn, strictDi, name) {
|
296 | 300 | * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
|
297 | 301 | * be retrieved as described above.
|
298 | 302 | *
|
| 303 | + * @param {boolean=} strictDi Disallow argument name annotation inference. Defaults to false. |
| 304 | + * |
299 | 305 | * @returns {Array.<string>} The names of the services which the function requires.
|
300 | 306 | */
|
301 | 307 |
|
|
0 commit comments