JSFiddle - React, Tailwind, and code Playground
by yasir zuberi
HTML
<script src="http://cdn.jsdelivr.net/angular.checklist-model/0.1.3/checklist-model.min.js"></script>
<div ng-app="check">
<div ng-controller="controller">
<label ng-repeat="fruit in fruitsList"><input type="checkbox" checklist-model="selected.fruits" checklist-value="fruit" /> {{fruit.name}}<br/> </label>
<button ng-click="checkAll()">Check all</button>
<button ng-click="uncheckAll()">Uncheck all</button> <br/>
{{selected.fruits}}
</div>
</div>
JavaScript
angular.module('check', ['checklist-model'])
.controller('controller', function($scope) {
$scope.fruitsList = [
{id: 1, name: 'Apple'},
{id: 2, name: 'Mango'},
{id: 3, name: 'Banana'},
{id: 4, name: 'Guava'},
{id: 5, name: 'Orange'}
];
$scope.selected = {
fruits: []
};
$scope.checkAll = function() {
$scope.selected.fruits = angular.copy($scope.fruitsList);
};
$scope.uncheckAll = function() {
$scope.selected.fruits = [];
};
});