Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.7/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
</head>
  
  
<body ng-controller="ctrl">
  <div>
    Last changed: {{changed | json}}
  </div>
  <ul>
    <li ng-repeat="button in buttons">
      <input type="checkbox" ng-model="button.checked"> {{button.name}}
    </li>
    
  </ul>
</body>
</html>
 
  var app = angular.module('app',[]);
  app.controller('ctrl', function($scope) {
    
    $scope.buttons = [
      { name: 'cancelled', checked: false},
      { name: 'booked', checked: false},
      { name: 'something', checked: false}
    ];
    $scope.$watch('buttons',function(newVal,oldVal){
      oldVal = oldVal.reduce(function(p,k){ p[k.name] = k.checked; return p;},{});
     
      var changed = newVal.filter(function(k){ 
        return oldVal[k.name] !== k.checked;
      });
     
      changed = changed.reduce(function(p,k){ p[k.name] = k.checked; return p;},{});
     $scope.changed = changed;
    },true);
    
  });  
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers