I have an ng-grid that I am trying to fill with some search results. The queries work as long as the result has a different amount of rows... If a query has the same amount of rows as the previous query... the result will not show.
// after a rest call
// we have the result
// #1 Clean gridData and local array
$scope.gridData.length = 0;
_labels.length = 0;
// #2 feed the grid
// these two functions add rows to the grid + data to the rows (and my local array)
addLabels(result.Labels);
addPhrases(result.Phrases);
// Second version attempting to call $scope.$apply
// does not work either
$scope.gridData.length = 0;
if (!$scope.$$phase) {
$scope.$apply();
}
_labels.length = 0;
addLabels(result.Labels);
addPhrases(result.Phrases);
if (!$scope.$$phase) {
$scope.$apply();
}
here is a plunker that demonstrates this: http://plnkr.co/edit/gSFtuL?p=preview
note that if you push one more (or one less) item, the grid refreshes