Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49172

Filter JSON Using Checkboxes with AngularJS

$
0
0

@amrayoub wrote:

Hello , I have been trying to solve this problem for days.
i'm trying to filter json data using checkbox , for example when i check more than one id , it shows the rest it's data


.controller('compareModelsCtrl',['$scope','$http', '$state' ,'$location',
function($scope, $http, $state,$location, filterFilter) {
$http.get('js/data.json').success(function(data){
$scope.models = data;
$scope.whichmodel = $state.params.modelId;
//$scope.toggleStar = function(model){
// model.star = !model.star;
//}
    });
  $scope.goL = function () {

         $state.go('tabsController.compareModels2');

};

    $scope.order = {

    };


  $scope.format=function(){
  $scope.modifiedOrder=[];
   angular.forEach($scope.order, function(value, key) {
    if(value){
      $scope.modifiedOrder.push(parseInt(key));
    }
});
}

   <ion-checkbox ng-repeat="model in models | filter:query" ng-model="order[model.id]"  ng-change="format()">{{model.model_number}}</ion-checkbox>
          </ion-item>
          current order : {{modifiedOrder}}

i found this code and i have trying to implement it http://blog.sodhanalibrary.com/2015/12/filter-json-data-with-check-boxes-using.html#.V9BCarl97VN

,any help , please

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49172

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>