Property binding on Model object does not work #20

Open
tshi0912 opened this Issue Jun 2, 2013 · 0 comments

Comments

Projects
None yet
1 participant

tshi0912 commented Jun 2, 2013

For example:

App.User = Ember.Resource.extend({
resourceUrl: '/users',
resourceName: 'user',
resourceProperties: ['name', 'selected']
});

App.UserController = Ember.ResourceController.extend({

selecteds: function(){
    var users = this.get('content');
    return users.filterProperty('selected', true);
}.property('content.@each.selected')

})

As the propery 'selected' is not prepared for Ember when initializing the observer, the property binding on 'content.@each.selected' won't work any more.
To fix the problem, you should declared the property you wanna binding explicitly, such as:

App.User = Ember.Resource.extend({
resourceUrl: '/users',
resourceName: 'user',
resourceProperties: ['name', 'selected'],
selected: false
});

I suggest the author to add this trick on the README.md, since l think lots of people will encounter this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment