Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Property binding on Model object does not work #20

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

Property binding on Model object does not work #20

tshi0912 opened this issue Jun 2, 2013 · 0 comments

Comments

@tshi0912
Copy link

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant