Checkbox Mutiple select
by Silambarasan_sundaram
HTML
<div ng-app="myApp" ng-controller="MyCtrl">
<lable ng-repeat="list in lists">
<input type="checkbox" ng-model="lst" ng-change="change(lst,list.vl)" ng-disabled="limitChk && lst != true">
{{list.vl}} <br>
</lable>
{{lst}}
</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.limitCount = 0;
$scope.limitChk = 0;
$scope.change = function(check,value){
if(check){
$scope.limitCount++
$scope.lst.push(value);
}else{
$scope.limitCount--
$scope.lst.splice($scope.lst.indexOf(value), 1);
}
if($scope.limitCount >= 2){
$scope.limitChk = 1;
}else{
$scope.limitChk = 0;
}
};
});