Sorting using Angularjs

ksd123
ksd123 used Ask the Experts™
on
I am working on responsive web design using Html5, angular material design and angularjs technologies. I have following code in  angularjs and need to sort by employee.JoinDate.Basically employee object contains "employee.Name","employee.Age","employee.JoinDate" etc.

<md-list>
<md-item ng-repeat="employee in vm.employees">

<md-item-content>

</md-item-content>
</md-item>

</md-list>

Open in new window


In the above code how can i sort by joindate?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Awarded 2012
Commented:
Hi,
you should be able to use the orderBy filter -
https://docs.angularjs.org/api/ng/filter/orderBy

Could you try the following? This should sort the JoinDate ascending.

<md-list>
<md-item ng-repeat="employee in vm.employees | orderBy:'JoinDate'">

<md-item-content>

</md-item-content>
</md-item>

</md-list>

Open in new window


Which Angular version?
HTH
Rainer

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial