Reputation: 525
I have a list of vochers that are shown with ng-repeat from a WebService, and each vocher has an associated checkbox, when I check a specific checkbox the price of the vocher is deduct of the Total Price, the problem in question is: " once the Total price is 0 I have to disable the unchecked checkbox" at the moment I can disable them all but I want to keep the checked checkboxes enable so I can uncheck them again.
HTML:
<div class="item" ng-class="{active:!$index}" ng-repeat="slide in MesAvoirs | limitTo: slideLength track by $index">
<div class="mes_avoires" ng-repeat="a in MesAvoirs | startFrom: ($index*5) | limitTo: 5">
<input class="mes_avoires_checkbox" type="checkbox" ng-model="check" ng-change="avoirPrixCal($index,check,a)" id="chBx-{{$index}}" ng-disabled="uncheckVar" />
<div class="left_av">
<em>{{"MonProfilMesAvoirs.Num_Avoir" | translate}} {{a.NumeroAvoir}}</em>
<strong>{{a.Montant}} {{"Globale.Devise" | translate}}</strong>
</div>
<div class="right_av">
<em translate="MonProfilMesAvoirs.Valide_till"></em>
<strong>{{a.DateValiditeJ }} {{a.DateValiditeM}} {{a.DateValiditeY}}</strong>
</div>
</div>
</div>
Upvotes: 0
Views: 1108
Reputation: 6878
If i understand your question you want to disable unchecked checkbox when the total price is equal to 0.
Why do you don't used a model to get the status of the checkbox (checked or unchecked) and test something like :
<input type="checkbox" ng-model="yourCtrl.checked[your_checkbox_number]" ng-disable="(yourCtrl.totalPrice <= 0 && !yourCtrl.checked[your_checkbox_number])/>
Upvotes: 1