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
This commit is contained in:
Clark Pan 2014-01-28 11:53:25 +11:00 committed by Caitlin Potter
parent 7a78aed160
commit e2173f9101

View file

@ -482,17 +482,16 @@ function annotate(fn) {
* Here is an example of registering a service using
* {@link AUTO.$provide#methods_service $provide.service(class)}.
* <pre>
* $provide.service('ping', ['$http', function($http) {
* var Ping = function() {
* this.$http = $http;
* };
* var Ping = function($http) {
* this.$http = $http;
* };
*
* Ping.$inject = ['$http'];
*
* Ping.prototype.send = function() {
* return this.$http.get('/ping');
* };
*
* return Ping;
* }]);
* Ping.prototype.send = function() {
* return this.$http.get('/ping');
* };
* $provide.service('ping', Ping);
* </pre>
* You would then inject and use this service like this:
* <pre>