Skip to content

Commit 67a9811

Browse files
committed
docs($provide): clarify value and constant injectability
Closes angular#14168
1 parent f1aea54 commit 67a9811

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
@@ -544,14 +544,13 @@ function annotate(fn, strictDi, name) {
544544
* @description
545545
*
546546
* Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
547-
* number, an array, an object or a function. This is short for registering a service where its
547+
* number, an array, an object or a function. This is short for registering a service where its
548548
* provider's `$get` property is a factory function that takes no arguments and returns the **value
549-
* service**.
549+
* service**. That also means it is not possible to inject other services into a value service.
550550
*
551551
* Value services are similar to constant services, except that they cannot be injected into a
552552
* module configuration function (see {@link angular.Module#config}) but they can be overridden by
553-
* an Angular
554-
* {@link auto.$provide#decorator decorator}.
553+
* an Angular {@link auto.$provide#decorator decorator}.
555554
*
556555
* @param {string} name The name of the instance.
557556
* @param {*} value The value.
@@ -576,8 +575,11 @@ function annotate(fn, strictDi, name) {
576575
* @name $provide#constant
577576
* @description
578577
*
579-
* Register a **constant service**, such as a string, a number, an array, an object or a function,
580-
* with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
578+
* Register a **constant service** with the {@link auto.$injector $injector}, such as a string,
579+
* a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not
580+
* possible to inject other services into a constant.
581+
*
582+
* But unlike {@link auto.$provide#value value}, a constant can be
581583
* injected into a module configuration function (see {@link angular.Module#config}) and it cannot
582584
* be overridden by an Angular {@link auto.$provide#decorator decorator}.
583585
*

0 commit comments

Comments
 (0)