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

Commit 722e97e

Browse files
committed
docs($provide): clarify value and constant injectability
Closes #14168
1 parent d3933a4 commit 722e97e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/auto/injector.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,13 @@ function annotate(fn, strictDi, name) {
540540
* @description
541541
*
542542
* Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
543-
* number, an array, an object or a function. This is short for registering a service where its
543+
* number, an array, an object or a function. This is short for registering a service where its
544544
* provider's `$get` property is a factory function that takes no arguments and returns the **value
545-
* service**.
545+
* service**. That also means it is not possible to inject other services into a value service.
546546
*
547547
* Value services are similar to constant services, except that they cannot be injected into a
548548
* module configuration function (see {@link angular.Module#config}) but they can be overridden by
549-
* an Angular
550-
* {@link auto.$provide#decorator decorator}.
549+
* an Angular {@link auto.$provide#decorator decorator}.
551550
*
552551
* @param {string} name The name of the instance.
553552
* @param {*} value The value.
@@ -572,8 +571,11 @@ function annotate(fn, strictDi, name) {
572571
* @name $provide#constant
573572
* @description
574573
*
575-
* Register a **constant service**, such as a string, a number, an array, an object or a function,
576-
* with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
574+
* Register a **constant service** with the {@link auto.$injector $injector}, such as a string,
575+
* a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not
576+
* possible to inject other services into a constant.
577+
*
578+
* But unlike {@link auto.$provide#value value}, a constant can be
577579
* injected into a module configuration function (see {@link angular.Module#config}) and it cannot
578580
* be overridden by an Angular {@link auto.$provide#decorator decorator}.
579581
*

0 commit comments

Comments
 (0)