Reputation: 7629
How can I iterate through an array/enumerable in Ember, while preserving the get
and set
functionality?
Fiddle with what I'm trying to do:
I have an action that iterates through 'widgets' and marks them disabled. How can I iterate through an array of widgets while allowing for something like widget.set('disabled', true)
.
The alternative of doing model.set('widgets.' + index + '.disabled', true)
seems very hacky.
Upvotes: 2
Views: 31
Reputation: 519
You're receiving that error because the objects in your array are not instances of Ember.Object
.
Here is an updated jsfiddle: http://jsfiddle.net/Lv4SF/8/
Upvotes: 2