mardi 28 juin 2016

How to filter a model by belongsTo relationship property in EmberJS

I'm trying to filter a findAll query to get only the elements without relationship.

My model is created by two classes:

Element

export default Model.extend({
    position: attr('number'),
    name: attr('string'),
    shared: attr('boolean', { defaultValue: false }),
    stack: belongsTo('stack')
});

 Stack

export default Model.extend({
  position: attr('number'),
  name: attr('string'),
  shared: attr('boolean', { defaultValue: false }),
  element: hasMany('element')
});

I have tried to filter by property stack filterBy('stack', null) and filterBy('stack.content', null) but they didn't run.

Any idea and help of how to filter by relationships?




Aucun commentaire:

Enregistrer un commentaire