diff options
| author | Lukas Ruebbelke | 2014-01-08 21:54:39 -0500 | 
|---|---|---|
| committer | Matias Niemelä | 2014-01-13 23:03:36 -0500 | 
| commit | e324c149077d99cb722ab3b9e05759cb4dfa07a9 (patch) | |
| tree | 58bd242631ab500f5d505a9e8e53ea9491bd2cd5 /src/auto | |
| parent | e1cfb1957feaf89408bccf48fae6f529e57a82fe (diff) | |
| download | angular.js-e324c149077d99cb722ab3b9e05759cb4dfa07a9.tar.bz2 | |
docs(provider): replaced coffeescript with comparable javascript example
Diffstat (limited to 'src/auto')
| -rw-r--r-- | src/auto/injector.js | 27 | 
1 files changed, 16 insertions, 11 deletions
diff --git a/src/auto/injector.js b/src/auto/injector.js index a04ff1e6..b14b8af2 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -474,7 +474,7 @@ function annotate(fn) {   * constructor function that will be used to instantiate the service instance.   *   * You should use {@link AUTO.$provide#methods_service $provide.service(class)} if you define your service - * as a type/class. This is common when using {@link http://coffeescript.org CoffeeScript}. + * as a type/class.   *   * @param {string} name The name of the instance.   * @param {Function} constructor A class (constructor function) that will be instantiated. @@ -482,20 +482,25 @@ function annotate(fn) {   *   * @example   * Here is an example of registering a service using - * {@link AUTO.$provide#methods_service $provide.service(class)} that is defined as a CoffeeScript class. + * {@link AUTO.$provide#methods_service $provide.service(class)}.   * <pre> - *   class Ping - *     constructor: (@$http) -> - *     send: () => - *       @$http.get('/ping') - * - *   $provide.service('ping', ['$http', Ping]) + *   $provide.service('ping', ['$http', function($http) { + *     var Ping = function() { + *       this.$http = $http; + *     }; + *    + *     Ping.prototype.send = function() { + *       return this.$http.get('/ping'); + *     };  + *    + *     return Ping; + *   }]);   * </pre>   * You would then inject and use this service like this:   * <pre> - *   someModule.controller 'Ctrl', ['ping', (ping) -> - *     ping.send() - *   ] + *   someModule.controller('Ctrl', ['ping', function(ping) { + *     ping.send(); + *   }]);   * </pre>   */  | 
