title: ngRepeat doesn't refresh rendered value
body: <p>I'm having an issue with ngRepeat :</p>
  
  <p>I want to display a list of students in two different ways. In the first one they are filtered by group, and in the second they are not filtered.
  The whole display being quite complex, I use a ngInclude with a template to display each student. I can switch between view by changing <code>bClasseVue</code>, each switch being followed by a <code>$scope.$apply()</code>.</p>
  
  <pre><code>&lt;div ng-if="currentCours.classesOfGroup !== undefined" 
       ng-show="bClassesVue"&gt;
      &lt;div ng-repeat="group in currentCours.classesOfGroup"&gt;
          &lt;br&gt;
          &lt;h2&gt;Classe : [[group.name]]&lt;/h2&gt;
          &lt;div class="list-view"&gt;
              &lt;div class="twelve cell" 
                   ng-repeat="eleve in group.eleves | orderBy:'lastName'" 
                   ng-include="'liste_eleves.html'"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="list-view" ng-show="!bClassesVue"&gt;
      &lt;div class="twelve cell" 
           ng-repeat="eleve in currentCours.eleves.all" 
           ng-include="'liste_eleves.html'"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My problem happens when my list of students change (<code>currentCours</code> here). Instead of refreshing the ngRepeat, both lists concatenate, but only in the unfiltered view.</p>
  
  <p>I tried adding some <code>$scope.$apply</code> in strategic places (and I synchronize my list for example) but it doesn't help.</p>
  
  <p>EDIT : the function used to refresh <code>currentCours</code> in the controller. It's called when a "cours" is selected inside a menu.</p>
  
  <pre><code>$scope.selectCours = function (cours) {
  
      $scope.bClassesVue = false;
      $scope.currentCours = cours;
      $scope.currentCours.eleves.sync().then(() =&gt; {
  
           if ($scope.currentCours.classe.type_groupe === 1) {
               let _elevesByGroup = _.groupBy($scope.currentCours.eleves.all, function (oEleve) {
                    return oEleve.className;
                });
                $scope.currentCours.classesOfGroup = [];
                for(let group in _elevesByGroup) {
                    $scope.currentCours.classesOfGroup.push({
                         name: group,
                         eleves: _elevesByGroup[group]
                    });
                 }
                 $scope.bClassesVue = true;
            }
      });
      utils.safeApply($scope);
  };
  </code></pre>