title: Writing Angular factory with CoffeeScript Class style
body: <p>Recently I am trying to learn AngularJs and CoffeeScript by writing a small app.<br>
  After reading some blogs I can write Angular controller and service with CoffeeScript Class style. The following is a example of controller.  </p>
  
  <pre><code>libr = angular.module('libr.controllers.main', [])
  class MainController
    @$inject: ['$scope']
    constructor: (@$scope) -&gt;
      @$scope.test = test
    test: ()-&gt;
      console.log 'Hello'
  libr.controller 'MainCtrl', MainController
  </code></pre>
  
  <p>And it works well.</p>
  
  <p>But I can't convert a Angular factory as following successfully with using Coffee Class style.</p>
  
  <pre><code>var app = angular.module('app', ['ngResource', 'ngRoute']);
  
  // Some APIs expect a PUT request in the format URL/object/ID
  // Here we are creating an 'update' method 
  app.factory('Notes', ['$resource', function($resource) {
    return $resource('/notes/:id', null,
        {
            'update': { method:'PUT' }
        });
  }]);
  </code></pre>
  
  <p>This code is a example code from AngularJs official website:<a href="http://docs.angularjs.org/api/ngResource.%24resource" rel="nofollow">http://docs.angularjs.org/api/ngResource.$resource</a>  </p>
  
  <p>Could anyone help me to convert it to CoffeeScript Class style?</p>