what I’m trying to do is pretty simple, I want to update an observable property from a list of objects. This is what I have:
// cars is an observablearray, and q is an observable
for(i=0; i < self.cars().length, i++) {
self.cars()[i].q(0);
}
The code is executed only once. If the current value of q is 0 then it goes to the next (i.e. i=1), but as soon as it changes 1 object it returns. Anybody has an explanation of this behaviour? Is there a “knockout” way to achieve this?
Thank you.
I tend to use the arrayForEach method for that:
Does that work any better for you?