I am having this DS.Model
Model = DS.Model.extend
date: DS.attr "string"
amount_payed: DS.attr "string"
user_name:DS.attr "string"
`export default Model`
Currently there is nothing in my controller
Controller = Em.Controller.extend()
export default Controller
This is the route
Route = Ember.Route.extend
model: () ->
return @store.find "user-account"
`export default Route`
From server I m getting response in json with date value like
"date": "1995-12-25 00:00:00"
This is the sample template
{{#each detail in model}}
<li>{{detail.date}}{{detail.amount_paid}}{{detail.user_name}}</li>
{{/each}}
How to I sort/filter the model in my controller so that when the template renders the model using {{#each detail in model}}
the details with latest dates are displayed first.Basically I want to sort the model using date property.Remember date comes like "date": "1995-12-25 00:00:00"
.
Will be ok if u guys can give a solution in javascript also(not necessarily coffescript)