@this at `property`


#1

Good day everyone.

I know that I can use @this to access itemController's property, e.g.:

foos: Em.computed.mapBy('@this', 'foo')

How can I access itemController's property in the next example?

foos: function() {}.property('@this.foo') // doesn't work
foos: function() {}.property('@this.@each.foo') // doesn't work too

Thanks.


#2

Assuming you’re working with an Array Controller, change the last line of your example code from:

foos: function() {}.property('@this.@each.foo')

to:

foos: function() {}.property('content.@each.foo')

#3

You would be enumerating over the array controllers model’s here which he doesn’t want to do, he/she wants to enumerate over the item controllers.

foos: function() {}.property('@each.foo')

Example: http://jsfiddle.net/NQKvy/1235/


#4

Cool, thanks.

I’ve tried @each.foo on Ember 1.5, but it didn’t work, that’s why I’ve created this topic.


#5

Ah, good catch; totally missed that.