Friday, 1 August 2014

AngularJs: order by filter

Use order by like this:

<tr ng-repeat="emp in empList | orderBy:joiningDate">
</tr>

Above code will show you emp list in ascending order of joining date.

<tr ng-repeat="emp in empList | orderBy:-joiningDate">
</tr>

You can see I used - (hyphen) in above code. Due to this hyphen employee list will show in descending order of joining date.