jeudi 2 avril 2015

Sort by name attribute

companies and ships both have a name attribute. But I don't understand how I can use sortProperties in this code:


app/controllers/index.js



import Ember from 'ember';

export default Ember.Controller.extend({
selectedCompany: null,

companies: function(){
var model = this.get('model.companies');
return model;
}.property(),

ships: function(){
var model = this.get('model.ships');
return model;
}.property()
});


app/routes/index.js



import Ember from 'ember';

export default Ember.Route.extend({
model: function() {
return {
companies: this.store.find('company'),
ships: this.store.find('ship')
};
}
});


How can I sort companies and ships by the name attribute?





Aucun commentaire:

Enregistrer un commentaire