Last active
August 29, 2015 14:00
-
-
Save brancusi/d23c3b608f0773838c11 to your computer and use it in GitHub Desktop.
Filter Mixin
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
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