0

I Would like to date date in descending order. I imagine that it is necessary to use the filters but I do not filter no comment. thank you in advance.

 this.$scope = $scope;
$scope.messages = [{
    name: ' Sinistre ',
    date: ' 19 Juillet 2016 à 09h34 '
},
{
    name: ' Changement adresse ',
    date: ' 21 mars 2016 à 10h00 '
},
{
    name: ' Autre ',
    date: ' 31 décembre 0h00 '
},
];
<a class="ma_td_none item-wrapper" href="#" data-ng-repeat="message in messages track by $index" data-ng-class="{ma_default_cursor: !hasLink(contrat)}">
<div class="item">
    <div class="picto presentation">
        <span class="icon icon-{{contrat.syntheseObjetAssu.cdObjAssu | lowercase}} fr"></span>
    </div>
    <div class="content">
        <div>
            <span class="epi-title">{{message.name}}</span>
        </div>
        <span class="epi-sub-title">{{message.date}}</span>
    </div>
    <div class="picto link">
        <span <%--data-ng-if="#" --%> class="icon icon-fleche-droite fr"></span>
    </div>
</div>
</a>
VPK
  • 3,010
  • 1
  • 28
  • 35
Romain Boutinet
  • 49
  • 1
  • 1
  • 6
  • This may help http://stackoverflow.com/questions/8900732/javascript-sort-objects-in-an-array-alphabetically-on-one-property-of-the-arra – rob2universe Jan 11 '17 at 14:12

1 Answers1

0

first you will need to transform your dates into a comparable form.

comparable forms are : timestamps or Y-m-d h-Mi-s

then you will be able to use the following:

data-ng-repeat="message in messages track by $index | orderBy:'new_comparable_date_format'"