angularjs - Disabling checkbox with one way binding -
i have 1 checkbox list. need disable elements have model value set false initially. because of 2 way binding have problem when deselect 1 checkbox becomes disabled. how 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 binding expression causes evaluated once. should need:
ng-disabled="::!element.value"
here's angular's docs on one-time binding.
Comments
Post a Comment