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

Commit

Permalink
docs(provider): replaced coffeescript with comparable javascript example
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Ruebbelke authored and matsko committed Jan 14, 2014
1 parent e1cfb19 commit e324c14
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,28 +474,33 @@ 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.
* @returns {Object} registered provider instance
*
* @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>
*/

Expand Down

0 comments on commit e324c14

Please sign in to comment.