-
-
Save alexspeller/e7f16963348f1d753851 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is in the appliation route: | |
setupController:function(controller, model) { | |
this._super(controller, model); | |
this.filterable(['ingredient', 'recipe']).then(function(array) { | |
controller.set('itemCollection', array) | |
}); | |
}, | |
//This doesn't work | |
filterable:function(types){ | |
return this.store.find('item').then(function(collection){ | |
return collection.filter(function(item){ | |
return types.contains(item.get('typeTag')); | |
}); | |
}); | |
} | |
//This works but is not filtered properly | |
filterable:function(types){ | |
return this.store.find('item'). | |
} | |
... | |
//This is in the controller | |
items:function(){ | |
return this.get('itemCollection'); | |
}.property('itemCollection.@each'), | |
... | |
//In the template. Not valid with the filtering cause items is a promise | |
{{#each items}} | |
{{this}} | |
{{/each}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment