I am relatively new to Angular.js and am having a problem with date sorting. I have looked around the web for similar issues, but haven\'t found any that are of quite the sa
be aware that it will compare string. It won't compare Dates. You will have to deal with Dates object.
Here is a talk about this.
Here is the solution from vojtajina
Here is part of the solution:
Main.prototype = {
sort: function(item) {
if (this.predicate == 'date') {
return new Date(item.date);
}
return item[this.predicate];
},
sortBy: function(field) {
if (this.predicate != field) {
this.predicate = field;
this.reverse = false;
} else {
this.reverse = !this.reverse;
}
},
reverse: false
};