lundi 16 octobre 2017

angularjs check all checkboxes with ng-repeat

I am working with angularjs and ng-repeat to show a list of checkboxes. The problem is that when I try to check a checkbox all checkboxes are checked. I would like to check only one.

  <div class="row">
    <div class="col-md-3 row rulesList" ng-repeat="filterData in presetData.filters">
      <div class="col-md-6">
        <div ng-if="presetData.type=='radio'">
          <input type="radio" name="presetRadio" class="preset-radio" ng-model="adminToolsPresetsCtrl.getRule().filters[presetData.name]" value="" ng-checked="filterData.active" />
        </div>-->
        <div ng-if="presetData.type=='checkbox'">
          <input type="checkbox" name="presetCheckbox" class="preset-checkbox" ng-model="adminToolsPresetsCtrl.getRule().filters[presetData.name]" value="" ng-checked="filterData.active" />
        </div>
      </div>
      <div class="col-md-6 presetsList"></div>
    </div>
  </div>

I tried to put an ID into the checkbox:

id=""

Thanks if someone can help me!




Aucun commentaire:

Enregistrer un commentaire