title: Modify subset of list inside click function
body: <p>I have a list of models which I am rendering using the following ng-click directive:</p>
  
  <pre><code>&lt;div id="pair" ng-repeat="question in session.questions | filter:{'answered':qfilter}"&gt;
  </code></pre>
  
  <p>Inside each of these questions, I have a vote button which calls a vote method on click:</p>
  
  <pre><code>&lt;a href="#" ng-click="vote(question, 1)" ng-class="{upvote: question.score == 1}"&gt;&amp;#x25B2;&lt;/a&gt;&lt;br/&gt;
  </code></pre>
  
  <p>Notice that this ng-click directive is passing the question variable to my function.</p>
  
  <p>Here's the vote function:</p>
  
  <pre><code>$scope.vote = function(question, val){
      $scope.apply(function(){
          if(question.vote == val){
              question.vote = 0;
          }else{
              question.vote = val;
          }
          $http({
              method: 'POST',
              url: question.resource_uri+"vote/",
              data: $.param({vote:question.vote}),
              headers: {'Content-Type': 'application/x-www-form-urlencoded'}
          });
      })
  }
  </code></pre>
  
  <p>This function is being called fine, and the post is being submitted successfully. The only problem is that even after running a $scope.apply, the value of question.vote is still not being updated in the UI. I'm guessing that it has something to do with ng-repeat duplicating arrays, so modifying the new question is not in turn modifying the question in scope.</p>
  
  <p>I have also tried updating the scope inline by returning the vote and using this ng-click:</p>
  
  <pre><code>&lt;a href="#" ng-click="question.vote = vote(question, -1)" ng-class="{downvote: question.score == -1}"&gt;&amp;#x25BC;&lt;/a&gt;
  </code></pre>