checkbox input

http://stackoverflow.com/questions/14834300/angularjs-checkbox-ng-repeat-and-seleted-objects

HTML

<div ng-controller="Ctrl">
    <label ng-repeat="fruit in fruits">
        <input type="checkbox" name="fruit.name" ng-model="fruit.value"></input>
        {{fruit.name}}</label>
        
    <button ng-click="init();">press me</button>
        
        <pre>fruits: {{fruits| json}}</pre> 
    <br></br>
    <pre>fruits COPY: {{fruitsCopy| json}}</pre> 
</div>

JavaScript

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

function Ctrl($scope) {

    $scope.fruits = [{
        name: 'apple',
        value: false
    }, {
        name: 'orange',
        value: false
    }, {
        name: 'pear',
        value: false
    }, {
        name: 'naartjie',
        value: false
    }];
    
    $scope.fruitsCopy = [];
    
     $scope.init = function(){
      $scope.fruitsCopy = angular.copy($scope.fruits );
    }
    
    

}