All checkboxes in the list is getting checked for maybe wrong value passing in ng-model

Prity Shaw
Tera Contributor

I have a requirement to create a custom widget for showing all case records and each case will be attached to a checkbox. So, whenever the checkbox is checked, the case item need to be pushed to an array.
Now, as for populating the case records I used ng-repeat, so even if i am checking on checkbox it is automatically checking all the items in the list. For the below portal snapshot, i just clicked on 1 case and system checked rest 2 automatically. which should not happen.

Assumption :This might be causing for the data passed in ng-model=c.data.item.. But i am not clear what value shall i pass in ng-model, so in client script i will get the item information as well as the checked/unchecked information and if it check 1 item in the list it should not check others.

6 REPLIES 6

suvro
Mega Sage

Images are not showing up. Give me the html part of the widget. 

Prity Shaw
Tera Contributor

Hi Suvro,

Attached the snapshots again. Please have a look

Regards,

Prity

skip the ng-model al together then try

Prity Shaw
Tera Contributor

I tried removing only  ng-model="c.data.item" but the list items gets disappear. Attached the portal snapshot after changing.

If i remove ' ng-model="c.data.item" ng-change="c.toggle({{item}}' completely, then the items are showing properly but i need to call the function for add the item values in the array. Not sure how to achieve this.

Regards,

Prity