Checkbox Mutiple select

by Guddu Kumar

HTML

<div ng-app="myApp" ng-controller="MyCtrl">
	<lable ng-repeat="list in lists">
        <input type="checkbox" ng-model="active" ng-change="change(list, active)" />
	{{list.vl}}
	</lable>
    
    <pre ng-bind="lst | json">
    </pre>
</div>

JavaScript

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

myApp.controller('MyCtrl', function($scope){
	$scope.lists = [
		{'vl' : 1},
		{'vl' : 2},
		{'vl' : 3},
		{'vl' : 4},
		{'vl' : 5},
	];

	$scope.lst = [];
	$scope.change = function(list, active){
  debugger
        if (active)
            $scope.lst.push(list);
        else
            $scope.lst.splice($scope.lst.indexOf(list), 1);
	};
});