jeudi 24 novembre 2016

Dynamically generate materializecss checkboxes

I am dynamically creating materializecss checkboxes through an ng-repeat. Problem is that in materialize, the 'for' on the checkbox label must correspond with the id on the input as such:

<div class="checkbox-patient-info-medical">
  <input type="checkbox" id="medical-checkbox">
  <label for="medical-checkbox"> Prior Authorization Required*</label>
</div>

I am generating fields with an ng-repeat, and there is 1 textbox for each generated set of field. Code as follows:

<div class="medical-insurance-holder" ng-repeat="person in vm.myData[0].medicalInsuranceContainer track by $index">
  <p class="patient-info-holder-text">
    RELATIONSHIP TO PATIENT:&nbsp&nbsp&nbsp<b></b>
  </p>
  <p class="patient-info-holder-text">
    GROUP NUMBER:&nbsp&nbsp&nbsp<b></b>
  </p>
  <p class="patient-info-holder-text">
    SUBSCRIBER D.O.B:&nbsp&nbsp&nbsp<b></b>
  </p>
  <div class="checkbox-patient-info-medical">
    <input type="checkbox" id="medical-checkbox"><label for="medical-checkbox"> Prior Authorization Required*</label>
  </div>
 </div>

How can I change the label for and id of these checkboxes as the ng-repeat creates them? If I leave it as is, I can only click on the first checkbox created.

Thanks




Aucun commentaire:

Enregistrer un commentaire