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.
Written by Sergey Moiseev
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Angularjs
Authors
Related Tags
#angularjs
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#