javascript - Sorting the date in JSON object angular JS -


i making angular application json object response. in response array have date element "lastupdatedby" want sort data through angular sort (orderby) latest updated data in bottom.

for comparison taking sysdate server in same json object "sysdate".

please provide me solution. don't know how give expression in orderby filter.

there's decent example of using orderby here:

angularjs orderby documentation

you should able this:

<tr ng-repeat="friend in friends | orderby:'lastupdatedby'">       <td>{{friend.name}}</td>       <td>{{friend.phone}}</td>       <td>{{friend.lastupdatedby}}</td> </tr> 

perhaps it'd if showed orderby have tried, isn't working...?

update

you can use orderby if wanted sort data in angularjs controller, using this:

$scope.sortedarray = $filter('orderby')($scope.unsortedarray, 'lastupdatedby', true); 

and you'd able most-recently updated item using:

$scope.sortedarray[0] 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -