vendredi 3 avril 2015

Where to put sortBy('name') in the controller?

The following controller doesn't result in any ships. If I delete



model = model.sortBy('name');


it results in all ships but obviously they are not sorted by the name attribute.


How can I fix this?


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('model.companies'),

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




Aucun commentaire:

Enregistrer un commentaire