vendredi 6 mars 2015

Filtering model data with Ember Enumerable methods

Full code:


http://ift.tt/1wbXklZ


I'm attempting to filter some model data by calling .filter on the record array returned from the store, but it has no effect.


My controller:



App.IndexController = Ember.Controller.extend({
fooDataOne: function() {
var fooData = this.get('fooData');
// If uncommented, I return both items
// return fooData;
return fooData.filter(function(item) {
console.log("Why am I not filtering?"); // Never called
if(item.get('id') == 1) { return true; }
});
}.property('fooData')
});


Is it not possible to call .filter as I'm wanting to here? What should I do instead?





Aucun commentaire:

Enregistrer un commentaire