Skip to content

Instantly share code, notes, and snippets.

@brancusi
Last active August 29, 2015 14:00
Show Gist options
  • Save brancusi/d23c3b608f0773838c11 to your computer and use it in GitHub Desktop.
Save brancusi/d23c3b608f0773838c11 to your computer and use it in GitHub Desktop.
Filter Mixin
export default Ember.Mixin.create({
filteredItemCollection:function(types){
var _this = this;
return new Ember.RSVP.Promise(function(resolve, error){
_this.store.find('item').then(function(collection){
var filtered = collection.filter(function(item){
return types.contains(item.get('typeTag'));
});
resolve(filtered);
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment