Skip to content

Commit ef03dfc

Browse files
alirezamirianpetebacondarwin
authored andcommitted
docs($injector): fix inaccuracy in $provide.service docs
Closes angular#12664 Closes angular#12665
1 parent 4ff9c02 commit ef03dfc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/auto/injector.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,20 @@ function annotate(fn, strictDi, name) {
491491
*
492492
* Register a **service constructor**, which will be invoked with `new` to create the service
493493
* instance.
494-
* This is short for registering a service where its provider's `$get` property is the service
495-
* constructor function that will be used to instantiate the service instance.
494+
* This is short for registering a service where its provider's `$get` property is a factory
495+
* function that returns an instance instantiated by the injector from the service constructor
496+
* function.
497+
*
498+
* Internally it looks a bit like this:
499+
*
500+
* ```
501+
* {
502+
* $get: function() {
503+
* return $injector.instantiate(constructor);
504+
* }
505+
* }
506+
* ```
507+
*
496508
*
497509
* You should use {@link auto.$provide#service $provide.service(class)} if you define your service
498510
* as a type/class.

0 commit comments

Comments
 (0)