angularjs - ng-checked not working along ng-change and ng-model -


i have checkbox has checked if property false. have next html:

 <input type="checkbox" ng-model="list.isproject" ng-checked="list.isproject==false"  name="isproject" id="isproject" ng-change="saveitem(list, 'isproject')"> not shared 

after checking/unchecking need update database , has not expected behaviour. basically, if isproject false, has checked. if gets unchecked, isproject value has become 1.

i solved issue i'll post here solution. didn't want modify model, used variable (somehow david suggested) named notshared , pass ng-model , parameter function ng-change. tried without passing parameter value not updating properly. still don't know why.

<input type="checkbox"  ng-model="notshared" name="isproject" id="isproject" ng-change="saveitem(list, 'isproject', notshared)"> not shared  

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -