angularjs - ng-checked="true" being ignored on checkbox -
i have checkbox checked state (ng-checked
) based on computed property (ng-checked="somefunction()"
).
for sake of example, let's assume check state should checked, ie: ng-checked="true"
.
however, clicking on checkbox uncheck it, meaning there's disconnect between ng-checked
declaration , actual state of checkbox:
<input type="checkbox" ng-checked="true">
so why clicking checkbox make unchecked if ng-checked
true?
ng-checked not intended lock value of checkbox, 1 way binding updates checkbox when property bound updated. can not bind primitives (in case boolean value), must bind property of object.
if want disable checkbox, use disabled="true" attribute.
Comments
Post a Comment