title: Angular $update resource
body: <p><strong>EDIT: If it's difficult to troubleshoot without me posting more code, let me know and I can add more to the question.</strong></p>
  
  <hr>
  
  <p>I have two instances of basically the same code, and one of them is working while the other isn't.  </p>
  
  <p><strong>Working fine:</strong> </p>
  
  <pre><code>$scope.update = function() {
    var question = $scope.question;
    question.$update(function() {
      $location.path('questions/' + question._id);
    });
  };
  </code></pre>
  
  <p><strong>Not working:</strong></p>
  
  <pre><code>$scope.updateAnswer = function() {
    var answer = $scope.answerEdited;
    answer.$update(function() {
      $location.path('questions/' + $routeParams.questionId);
    });
  
    $scope.toggleEditAnswer(answer);
  };
  </code></pre>
  
  <p>I get the error: <em>undefined is not a function</em> at my <code>$update</code> function.  Here's my resource:</p>
  
  <pre><code>angular.module('intquestApp')
    .factory('Answers', function ($resource) {
      return $resource('api/answers/:answerId', {
        answerId: '@_id'
      }, {
        update: {
          method: 'PUT'
        }
      });
    });
  </code></pre>
  
  <p>What exactly am I doing wrong?  If I understand the flow correctly, the <code>answer.$update</code> uses the resource somehow?  Also, if I use <code>console.log</code> to view what <code>answer</code> is being updated, it is the correct one:</p>
  
  <pre><code>Resource {_id: "543d8896039390eb5e000001", created: "2014-10-14T20:33:26.514Z", creator: Object, questionid: "543d8693994fc1685d000001", __v: 0…}
  </code></pre>
  
  <p>How exactly can I troubleshoot this?</p>