title: ng-class doesn't update when it should after function invoked with ng-click is executed
body: <p>I've got a problem with ng-class in AngularJS - it doesn't update properly. </p>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;div class="cal-day" ng-repeat="day in schedule"&gt;
      ...
      &lt;div class="entry" ng-click="entryDetails(entry)" ng-repeat="entry in day.blockGrid"
       ng-class="{'selected': isSelected(entry), 'bg-{{entry.color}}': entry, 'bg-empty': !entry}"&gt;
           {{isSelected(entry)}}
           ...
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>$scope.entryDetails = function(entry) {
      $scope.entryForDetails = entry;
  };
  
  $scope.isSelected = function(entry) {
      return $scope.entryForDetails === entry;
  };
  </code></pre>
  
  <p>CSS class <em>selected</em> is implemented fine - when I replace <em>isSelected(entry)</em> with <em>true</em> in <em>ng-class</em>, the class gets applied properly.<br>
  Same thing with <em>isSelected()</em> function - it correctly prints <em>true</em> or <em>false</em> depending on whether the item is selected.<br>
  Even though both elements work, they somehow refuse to work together, and the div class doesn't get updated to <em>selected</em> when <em>isSelected(entry)</em> returns <em>true</em>.</p>
  
  <p>Edit:</p>
  
  <p><strong>Model stored in <em>day</em></strong></p>
  
  <pre><code>  {
      "date": "6.6.2013",
      "blockGrid": [
        null,
        null,
        null,
        null,
        null,
        null,
        {
          "group": "ABCD",
          "subjectName": "AB CD",
          "subjectShorthand": "PW",
          "type": "c",
          "number": 4,
          "profName": "ABAB",
          "date": "2013-06-05T22:00:00.000Z",
          "venue": "329 S",
          "timetableBlock": 7,
          "color": 16,
          "_id": "51c3a442eb2e46a7220000e2"
        }
      ]
    }
  </code></pre>
  
  <p>As you can see, it's an array of 7 elements which are either null or contain an <em>entry</em> object.</p>
  
  <p>I forgot to mention that posted section of my view is inside another ng-repeat. View code snippet above is now expanded to reflect that.</p>