Filtering a collection based on the existence of an object in each hasMany in Ember.js -
I try to filter an example of , This is a simple question that I am still dirty with my javascript promises. I think you are having problems here: Sorry if my syntax is not perfect I am not very familiar with "Coffeescript. Ember.Enumerable based on the existence of an object I am here. Each item has
Haimney association.
App.Project = DS.Model.extend User: DS.hasMany 'user', async: true App.User = DS Model.extend () < P> How can I filter the collection of projects based on the existence of an individual user object in each project
user array ?
users = @ store.find ('user', 1) @ store.find ('project'). Filter (Project) - & gt; Project.get ('user'). Then (user) - & gt;
User property
async: true on the
project model on user
project.get ( 'User'), which in turn is returning from the
filter () call instead, I have to return it to the
user Whether or not the
user is an object in the array.
project. Get ('user'). Then (user) - & gt; The first parameter of
then is the callback that you use on success, the resulting response, you should do it more:
users = @ store.find ('user', 1) @ store.find ('project'). Filter (Project) - & gt; User = project.get ('user'). Then () - & gt; Users.contains (user)
Comments
Post a Comment