title: angularjs calling $resource parameters and dollar sign
body: <p>In the "wire up a backend" demo code from the angularjs site they set up a db call.  From what I can tell they're extending the update function in order to add some extra parameters needed by the mongolab api.</p>
  
  <pre><code>angular.module('mongolab', ['ngResource']).
  factory('Project', function($resource) {
    var Project = $resource('https://api.mongolab.com/api/1/databases' +
        '/angularjs/collections/projects/:id',
        { apiKey: '4f847ad3e4b08a2eed5f3b54' }, {
          update: { method: 'PUT' }
        }
    );
  
    Project.prototype.update = function(cb) {
      return Project.update({id: this._id.$oid},
          angular.extend({}, this, {_id:undefined}), cb);
    };
  </code></pre>
  
  <p>Then they call the update property like this:</p>
  
  <pre><code>$scope.save = function() {
  $scope.project.update(function() {
    $location.path('/');
  });
  </code></pre>
  
  <p>I've tried using this code to build a demo app using a local development server so I've omitted extending the update property as I don't need the extra $oid parameter.  What I do need is to specify that the update method should use PUT.  My code is like this:</p>
  
  <pre><code>var Unit = $resource('http:/localhost/api/unit/:id', {id:'@Unit_Id'},
  {'update': { method: 'PUT' }}); 
  </code></pre>
  
  <p>And then calling it like this:</p>
  
  <pre><code>$scope.save = function () {
      $scope.unit.update(function () {
          $location.path('/unitlist');
      });
  </code></pre>
  
  <p>But What I've discovered is that the code only runs with a dollar sign in front of update like this:</p>
  
  <pre><code>    $scope.save = function () {
      $scope.unit.$update(function () {
          $location.path('/unitlist');
      });
  </code></pre>
  
  <p>So here are my questions:</p>
  
  <ol>
  <li>In the demo code, where is "update" actually added to the Project variable?  As a parameter in $resource or using prototype to extend Project?</li>
  <li>Why is update undefined in my code unless I prefix $ when I call it?</li>
  </ol>