Here is the fiddle http://jsfiddle.net/lumixraku/xgLz7d4j/2/
html
<body ng-app="app"> <div ng-controller='controller'> <ng-form name="formName"> <input type="text" ng-model="val1" required/> <div ng-show="myForm.items" ng-repeat="item in myForm.items"> <label> <input type="checkbox" name="group[]" ng-model="$parent.selectedValue[item.id]" value="{{item.id}}" ng-required="!someSelected($parent.selectedValue)" />{{item.sId}}</label> </div>{{selectedValue}} <input type="submit" ng-disabled="formName.$invalid"> {{formName.$invalid}} </ng-form > </div> </body>
JS
app = angular.module('app', []);
app.controller('controller', function ($scope) {
$scope.myForm = {};
$scope.selectedValue = {};
$scope.myForm.items = [{
id: 1,
sId: "analog"
}, {
id: 2,
sId: "isdn"
}, {
id: 3,
sId: "dsl"
}];
$scope.someSelected = function (obj) {
console.log('some selecgted');
var rs=Object.keys(obj).some(function (key) {
return obj[key];
});
console.log(rs);
return rs;
}
$scope.submitForm = function(){
$scope.clickSubmit = 'clickSubmit';
}
});