Answer the question
In order to leave comments, you need to log in
How to use angular.filter in controller function?
When select changes, the data type and value are passed to the function (ng-change="sortEvents(type, value)")
In the function itself, you need to filter by all elements of $scope.events, selecting all elements with a "state" value equal to "NSW"
$scope.sortEvents = function(type, value, $scope, $filter) {
$scope.events = $filter('filterBy')($scope.events, ['state'], 'NSW');
console.log($scope.events);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question