dimanche 2 août 2015

How to use `filterBy` with has_many relationship Ember Cli?

There are two models: mevent and mcalendar.
mcalendar has_many mevents.
I have this code in my afterModel hook, I would like to filter mevents of mcalendar by one of mevent property. How can I do it?

 afterModel: function () {

var _this = this;
var model = this.modelFor(this.routeName);

  return model.get('mevents').then(function(mevents) {
    var allMevents = mevents.map(function(mevent){
      return {
                title: mevent.get('title'),
                start: mevent.get('start')
              };
    });

I tried to use filterBy,but it did not work.

Thanks




Aucun commentaire:

Enregistrer un commentaire