Below is the code snippet for my $scope.watch
function:
$scope.logChecked = [];
$scope.selectAll = false;
$scope.$watch('selectAll', function(selectAll) {
console.log($scope.logChecked.length, $scope.logChecked, selectAll);
});
The output of console.log()
correctly displays the elements in $scope.logChecked
, while $scope.logChecked.length
shows 0
0 [pf2n1448: false, cc7a1340: false, cc7a1328: false, pf2n1424: false, if2n1328: false…] true
I am using the following checkbox to update logChecked:
<td><input type="checkbox" ng-model="logChecked[log.batchId]"/></td>
Can anyone help decipher what's happening in this scenario?