I have an array of objects as follow.
$scope.students = [{'isSelected': true},
{'isSelected': true},
{'isSelected': false},
{'isSelected': true},
{'isSelected': true},
]
How can i get the count items that have isSelected property set to true ?
UPDATE:
The problem is $scope.students is fetched from a REST api and simply looping over the $scope.students variable does not work as the variable is undefined until the request is completed, and so the loop code errors out saying $scope.students is not defined.
I tried using $watch but in that case i have to define the loop under the watch directive and it only works one time when $scope.students is defined, after that the loop does not work as $scope.students itself is not changing.