2016-06-16 3 views
0

checbox의 데이터 세트가 필요하다는 갈레 필요가 있지만 그것이 그것 checbox 요소 중 적어도 하나를 표시하는 것을 주목해야하며, 모두 표시하지 않아도, 요청과 검증을위한 최소 크기.요구 된 HTML AngularJS와 및 chekbox

어떻게 HTML과 AngularJS와에서이 작업을 수행하려면? 여기 내 코드 :

<div class="checkbox" ng-repeat="unit in units"> 
 
\t \t  <label> 
 
\t \t  <input type="checkbox" checklist-model="center.unit_ids" checklist-value="unit.id" > {{ unit.name }} 
 
\t \t  </label> 
 
\t \t </div>

답변

-1
<div class="checkbox" ng-repeat="unit in units"> 
    <label> 
    <input type="checkbox" checklist-model="center.unit_ids" checklist-value="unit.id" ng-required="center.unit_ids.length==0"> {{ unit.name }} 
    </label> 
</div> 
+0

감사 이것을 soluction! –

1

희망이 도움이됩니다.

<script> 
     angular.module('checkboxExample', []) 
     .controller('ExampleController', ['$scope', function($scope) { 
      $scope.checkboxModel = { 
      value1 : true, 
      value2 : 'YES' 
     }; 
     }]); 
    </script> 
    <form name="myForm" ng-controller="ExampleController"> 
     <label>Value1: 
     <input type="checkbox" ng-model="checkboxModel.value1"> 
     </label><br/> 
     <label>Value2: 
     <input type="checkbox" ng-model="checkboxModel.value2" 
       ng-true-value="'YES'" ng-false-value="'NO'"> 
     </label><br/> 
     <tt>value1 = {{checkboxModel.value1}}</tt><br/> 
     <tt>value2 = {{checkboxModel.value2}}</tt><br/> 
    </form>