angularjs - reapply filter when scope changes -
i have applied custom filter check checkboxes belonging group have been checked.
the filter hides groups of checkboxes none of them have been checked.
what need is, reapply filter when box checked or unchecked. .so when checkboxes belonging group unchecked, rest of groups show up.how go it?
<ul ng-repeat="(key,value) in filtered=(properties | filter:filterbycategory| groupby: 'name') "> <li>group name: <strong>{{ key }}</strong></li> <div ng-repeat="prop in value"> <label> <input type="checkbox" ng-model="filter[key][$index]" ng-change="changed"/> <span>{{prop.property}}</span> </label> </div> </ul>
i guess need this: mentioned here ng-change
.
plunkr:
try:
i tried changing this:
<input type="checkbox" ng-model="filter[key][$index]" ng-change="firefilter(key)">
and
$scope.firefilter = function(prop){ console.log("prop when called" + prop); $filter('filterbycategory')(prop); $scope.filter=[]; } });
but gives me error says:
error: [$injector:unpr] http://errors.angularjs.org/1.2.22/$injector/unpr?p0=filterbycategoryfilterprovider%20%3c-%20filterbycategoryfilter @ error (native) @ https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:6:450 @ https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:36:145 @ object.c [as get] (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:34:236) @ https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:36:213 @ object.c [as get] (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:34:236) @ $get (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:124:238) @ k.$scope.firefilter (file:///c:/users/dev4/desktop/grouping/js/scipt.js:40:2) @ db.functioncall (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:176:387) @ k.$get.k.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js:112:15)
Comments
Post a Comment