Last Updated: February 25, 2016
·
892
· bopm

Filtering data in AngularJS controller using $filterProvider

So you have collection and set some properties inside of it. In my case it's selected property.

<input type="checkbox" data-ng-model="point.selected" data-ng-change="selectPoint(point)"/>

And you need to implement check that there is any selected objects in collection:

$scope.selectPoint = function selectPoint(point) {   
  if($filter('filter')($scope.points, {selected:true}, true).length > 0) {
    $scope.nextStepAvailable = true;
  } else {
    $scope.nextStepAvailable = false;
  }
}

So now it possible to set use nextStepAvailable variable to enable/disable submit button.