mardi 19 avril 2016

Validating checkboxes angular

How to validate this checkboxes, at least one must be checked, if not, there has to be some message or alert

<div class="form-group" ng-class="{ 'has-error' : actionsAddForm.active.$invalid && !actionsAddForm.active.$pristine }">
    <label class="control-label col-sm-2">Days*</label>
    <div class="col-sm-10">
        <label>Monday
          <input type="checkbox" ng-model="actions.value1">
        </label>
        <label>Tuesday
          <input type="checkbox" ng-model="actions.value2">
        </label>
        <label>Wednesday
          <input type="checkbox" ng-model="actions.value3">
        </label>
        <label>Thursday
          <input type="checkbox" ng-model="actions.value4">
        </label>
        <label>Friday
          <input type="checkbox" ng-model="actions.value5">
        </label>
        <label>Saturday
          <input type="checkbox" ng-model="actions.value6">
        </label>
        <label>Sunday
          <input type="checkbox" ng-model="actions.value7">
        </label>
    </div>

Aucun commentaire:

Enregistrer un commentaire