vendredi 16 février 2018

Update ng-model value of checkbox value on the basis of other checkbox ng-model

I'm trying to update a checkbox on the basis of other checkbox.

Here is my first checkbox that is enabled and user can change its value;

<label>
  <input type="checkbox" id="chkAddVerification" name="chkAddVerification" 
  ng-model="chkAddVerification" ng-checked="chkAddVerification">
  Add Verification
</label>

And this is second checkbox that is disabled and updated according to first checkbox value;

<label>
   <input type="checkbox" id="chkSendCodeByEmail" name="chkSendCodeByEmail" 
   ng-model="chkSendCodeByEmail" ng-disabled="true" ng-checked="chkAddVerification">
   By Email
</label>

This is how I'm trying to bind first checkbox ng-model value to second checkbox ng-checked : ng-checked="chkAddVerification"

Apparently it is working fine (checking/ unchecking of second according to first one) but it does not update ng-model value of second checkbox.

If I check first checkbox chkAddVerification, second one also checks accordingly but ng-model chkSendCodeByEmail has false value in it.

What I'm missing here??




Aucun commentaire:

Enregistrer un commentaire