lxe
lxe

Reputation: 7629

Iterate through an enumerable while preserving Ember.js bindings.

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:

http://jsfiddle.net/Lv4SF/6/

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

Answers (1)

Jason
Jason

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

Related Questions