Here is a possible solution, although it may not be the optimal one:
$scope.$watch('lists', function(lists){
$scope.count = 0;
angular.forEach(lists, function(list){
if(list.checked){
$scope.count += 1;
if (inputsList.indexOf(list.id) == -1) {
inputsList.push(list.id);
};
} else {
inputsList.pop(list.id);
}
})
}, true);
Using a similar approach with some modifications:
index.html (incorporated ng-click)
<input type="checkbox" name="list_id[]" ng-model="list.checked" value="{{list.id}}" ng-click='updateItem(list)' />
app.js (eliminated $scope.$watch and made changes)
$scope.currentSelectedItem = [];
$scope.updateItem = function(item) {
if(item.checked) {
$scope.currentSelectedItem.push(item);
} else {
$scope.currentSelectedItem.pop(item);
}
}