Angular: Empty Fiddle

http://angularjs.org/

by Sourabh_

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
    <input type="checkbox" ng-model="checkAllContact1" ng-change="checkAllContact()"/>
     <div ng-repeat="item in contacts">
         <input type="checkbox" ng-model="item.check"/>
     </div>
</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.contacts = [
        {"name": "Bambizo", "check": false},
        {"name": "Jimmy", "check": false},
        {"name": "Tommy", "check": false},
        {"name": "Nicky", "check": false}
];
    $scope.checkAllContact = function(){
        if ($scope.checkAllContact1) {
            $scope.checkAllContact1 = true;
        } else {
            $scope.checkAllContact1 = false;
        }
        angular.forEach($scope.contacts, function (item) {
            item.check = $scope.checkAllContact1;
        });
    }
}