I have one checkbox list. I need to disable all elements which have model value set to false initially. But because of two way binding I have a problem when I deselect one checkbox it becomes disabled. How to solve it?
<div class="item-s" ng-repeat="element in model.elements">
    <input id="element{{$index.toString()}}"
        type="checkbox"
        ng-true-value="true"
        ng-false-value="false"
        ng-model="element.value"
        ng-disabled="!element.value" />
    <label for="element{{$index.toString()}}">{{element.name}}</label>
</div>
                Adding :: in front of a binding expression causes it to only be evaluated once. This should get you what you need:
ng-disabled="::!element.value"
Here's Angular's docs on one-time binding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With