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

Commit e2173f9

Browse files
clark-pancaitp
authored andcommitted
docs($provide): return instance of Ping, rather than constructor
Updating $provide.service method docs The previous example provided for the service method did not work. I've updated the example to a working example. I think this version of the example will probably make more sense to most people, and the factory method would be a better place for this sort of example. Closes #6008
1 parent 7a78aed commit e2173f9

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/auto/injector.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -482,17 +482,16 @@ function annotate(fn) {
482482
* Here is an example of registering a service using
483483
* {@link AUTO.$provide#methods_service $provide.service(class)}.
484484
* <pre>
485-
* $provide.service('ping', ['$http', function($http) {
486-
* var Ping = function() {
487-
* this.$http = $http;
488-
* };
489-
*
490-
* Ping.prototype.send = function() {
491-
* return this.$http.get('/ping');
492-
* };
485+
* var Ping = function($http) {
486+
* this.$http = $http;
487+
* };
488+
*
489+
* Ping.$inject = ['$http'];
493490
*
494-
* return Ping;
495-
* }]);
491+
* Ping.prototype.send = function() {
492+
* return this.$http.get('/ping');
493+
* };
494+
* $provide.service('ping', Ping);
496495
* </pre>
497496
* You would then inject and use this service like this:
498497
* <pre>

0 commit comments

Comments
 (0)