var benimapp = angular.module("myApp", []);
benimapp.controller("myControl", function($scope) {
$scope.deletedItems = [];
$scope.myDatalar = [
{ "name" : "Monkey", "state": false , "image":"https://i.pinimg.com/736x/27/52/c4/2752c45b7c3bfa90192171439f3a3ee0--monkey-primates.jpg" },
{ "name" : "Chimpanzee", "state": false , "image":"https://i.pinimg.com/236x/bf/42/85/bf42855d50f2a491e26344c1b9683527.jpg" },
{ "name" : "Caterpillar", "state": true , "image":"https://i.pinimg.com/236x/ac/2d/dc/ac2ddceb9076a7d9933061e382bf007e--moth-caterpillar.jpg" },
{ "name" : "Jaguar", "state": false , "image":"https://i.pinimg.com/236x/98/02/06/9802062cad1783945fe22015bf331683.jpg" }
];
$scope.total = $scope.myDatalar.length;
$scope.sec = function(){
$scope.total = $scope.myDatalar.length;
$.each($scope.myDatalar, function(i, dataItem){
$scope.myDatalar[i].state = true;
});
}
$scope.kaldir = function(){
$scope.total = $scope.myDatalar.length;
$.each($scope.myDatalar, function(i, dataItem){
$scope.myDatalar[i].state = false;
});
}
$scope.sil = function(){
$scope.deletedItems = $scope.myDatalar.filter(function(delitem){
return delitem.state == true;
});
$scope.rakam = $scope.deletedItems.length;
$scope.total = $scope.myDatalar.length - $scope.rakam ;
}
});