How do I sort models using only a route in Ember?

后端 未结 2 796
没有蜡笔的小新
没有蜡笔的小新 2021-01-13 13:03

In the past you could use ArrayControllers (deprecated in 1.13.0), and we know that shortly controllers won\'t be recommended in ember. Is it currently possible to sort my m

2条回答
  •  孤城傲影
    2021-01-13 13:20

    This would seem to get the job done, unless I'm missing something.

    export default Ember.Route.extend({
      model: function() { 
        return this.store.findAll('order') .
          then(orders => orders.sortBy('name'));
      }
    });
    

提交回复
热议问题