Skip to content

Commit f57682c

Browse files
author
Brice Leroy
committed
fix(#5041): Ensure length watchers transmit data
When in fastWatch mode, watcher methods returns the length of their array being watched. When this value (integer). This value (int) is then being passed to the watcher's callback overwriting the array.
1 parent 60fe84b commit f57682c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/core/directives/ui-grid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
}, dataWatchFunction) );
5252
} else {
5353
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data; }, dataWatchFunction) );
54-
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data.length; }, dataWatchFunction) );
54+
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data.length; }, function(){ dataWatchFunction($scope.uiGrid.data); }) );
5555
}
5656
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) );
57-
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs.length; }, columnDefsWatchFunction) );
57+
deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs.length; }, function(){ columnDefsWatchFunction($scope.uiGrid.columnDefs); }) );
5858
} else {
5959
if (angular.isString($scope.uiGrid.data)) {
6060
deregFunctions.push( $scope.$parent.$watchCollection($scope.uiGrid.data, dataWatchFunction) );

0 commit comments

Comments
 (0)