Creating private variable in a repeating list

Hi guys,

I’m trying to create a repeating list served from an API with a unique counter for each row to indicate the quantity per item, I created this as a component and defined a private variable for the counter, and basically added a simple logic to increment / decrement the quantity when pressing the +/- buttons respectively.

The counter works just fine in the component but it stops working when the component is repeating from the API response, I checked in debug mode and the counter value is being updated properly but for some reason it’s not updating in the UI as it’s always showing the initial value.

Would appreciate your help on this, did a lot of research but couldn’t find anything that solves this issue

Hi, i wasnt able to read your post very carefully, but i think this will solve your issue, you will need to play around to figure it out. Instead of private variable, try using a property and set it to two way binding. that way, you could set the price from outside the composite component.

Hope this helps

1 Like