lundi 30 octobre 2017

Not able to sort, getting error

I am trying to sort my model. But getting a error as

Cannot read property 'sort' of undefined

any one help me to sort this out? I guess that model is not existing in Computed methods.

here is my code :

import Ember from 'ember';

export default Ember.Route.extend({
  model(){
    return [{"name":"fruit"},{"name":"flowers"}]
  },
  sortingByKey:['date'],
  sorter:Ember.Computed.sort("model","sortingByKey"), 
  init(){
    var sort = this.get("sorter");
  }
});

Twiddle Here




Aucun commentaire:

Enregistrer un commentaire