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?

demo plunkr here

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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -