Skip to content

Commit e324c14

Browse files
Lukas Ruebbelkematsko
Lukas Ruebbelke
authored andcommitted
docs(provider): replaced coffeescript with comparable javascript example
1 parent e1cfb19 commit e324c14

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/auto/injector.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,28 +474,33 @@ function annotate(fn) {
474474
* constructor function that will be used to instantiate the service instance.
475475
*
476476
* You should use {@link AUTO.$provide#methods_service $provide.service(class)} if you define your service
477-
* as a type/class. This is common when using {@link http://coffeescript.org CoffeeScript}.
477+
* as a type/class.
478478
*
479479
* @param {string} name The name of the instance.
480480
* @param {Function} constructor A class (constructor function) that will be instantiated.
481481
* @returns {Object} registered provider instance
482482
*
483483
* @example
484484
* Here is an example of registering a service using
485-
* {@link AUTO.$provide#methods_service $provide.service(class)} that is defined as a CoffeeScript class.
485+
* {@link AUTO.$provide#methods_service $provide.service(class)}.
486486
* <pre>
487-
* class Ping
488-
* constructor: (@$http) ->
489-
* send: () =>
490-
* @$http.get('/ping')
491-
*
492-
* $provide.service('ping', ['$http', Ping])
487+
* $provide.service('ping', ['$http', function($http) {
488+
* var Ping = function() {
489+
* this.$http = $http;
490+
* };
491+
*
492+
* Ping.prototype.send = function() {
493+
* return this.$http.get('/ping');
494+
* };
495+
*
496+
* return Ping;
497+
* }]);
493498
* </pre>
494499
* You would then inject and use this service like this:
495500
* <pre>
496-
* someModule.controller 'Ctrl', ['ping', (ping) ->
497-
* ping.send()
498-
* ]
501+
* someModule.controller('Ctrl', ['ping', function(ping) {
502+
* ping.send();
503+
* }]);
499504
* </pre>
500505
*/
501506

0 commit comments

Comments
 (0)