Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3c67abd

Browse files
committed
doc(injector): adds strictDi documentation to appropriate methods.
Closes #9624
1 parent 764fa86 commit 3c67abd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/auto/injector.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
1414
* @param {Array.<string|Function>} modules A list of module functions or their aliases. See
1515
* {@link angular.module}. The `ng` module must be explicitly added.
16+
* @param {boolean=} strictDi Disallow argument name annotation inference. Defaults to false.
1617
* @returns {injector} Injector object. See {@link auto.$injector $injector}.
1718
*
1819
* @example
@@ -159,7 +160,8 @@ function annotate(fn, strictDi, name) {
159160
*
160161
* In JavaScript calling `toString()` on a function returns the function definition. The definition
161162
* 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.
163165
*
164166
* ## `$inject` Annotation
165167
* By adding an `$inject` property onto a function the injection parameters can be specified.
@@ -244,6 +246,8 @@ function annotate(fn, strictDi, name) {
244246
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
245247
* ```
246248
*
249+
* You can disallow this method by using strict injection mode.
250+
*
247251
* This method does not work with code minification / obfuscation. For this reason the following
248252
* annotation strategies are supported.
249253
*
@@ -296,6 +300,8 @@ function annotate(fn, strictDi, name) {
296300
* @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
297301
* be retrieved as described above.
298302
*
303+
* @param {boolean=} strictDi Disallow argument name annotation inference. Defaults to false.
304+
*
299305
* @returns {Array.<string>} The names of the services which the function requires.
300306
*/
301307

0 commit comments

Comments
 (0)