lundi 14 décembre 2015

Is it possible to order the hasMany relative data in Ember with Emberfire?

I've two different models, with hasMany/belongsTo relationships between them. Ordering the request regular positions (like in this case name) by Emberfire it's easy. But I cannot figure it out how to do it with relationships
On the route's template we have Model1 in the route and loop through different positions on model 1. Inside, we loop through linked model2 positions, but they should be ordered by day
Model 1

export default DS.Model.extend({
  name : DS.attr('string'),
  model2 : DS.hasMany('model2', {async: true})
});

Model 2

export default DS.Model.extend({
  day : DS.attr('number'),
  model1 : DS.belongsTo('model1', { async: true })
});




Aucun commentaire:

Enregistrer un commentaire