From 026d7cb9f5f075a9d4b65563b26d195708d0bca4 Mon Sep 17 00:00:00 2001 From: Clark Pan Date: Tue, 28 Jan 2014 11:53:25 +1100 Subject: [PATCH] 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. --- src/auto/injector.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/auto/injector.js b/src/auto/injector.js index becc878dc641..3d2ac62895e2 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -482,17 +482,16 @@ function annotate(fn) { * Here is an example of registering a service using * {@link AUTO.$provide#methods_service $provide.service(class)}. *
- *   $provide.service('ping', ['$http', function($http) {
- *     var Ping = function() {
- *       this.$http = $http;
- *     };
- *   
- *     Ping.prototype.send = function() {
- *       return this.$http.get('/ping');
- *     }; 
+ *   var Ping = function($http) {
+ *     this.$http = $http;
+ *   };
+ * 
+ *   Ping.$inject = ['$http'];
  *   
- *     return Ping;
- *   }]);
+ *   Ping.prototype.send = function() {
+ *     return this.$http.get('/ping');
+ *   };
+ *   $provide.service('ping', Ping);
  * 
* You would then inject and use this service like this: *