JSFiddle - React, Tailwind, and code Playground
by poppypoop
HTML
<script>
var myApp = angular.module("myApp",[]);
function myCtrl($scope){
$scope.descending = false;
$scope.columnToOrderBy = 'date';
$scope.data = [
{
date: "2014-06-19T05:00:00",
Location: "California"
},
{
date: "2014-07-13T08:00:00",
Location: "Texas"
},
{
date: "2013-07-13T08:00:00",
Location: "Florida"
}
];
}
</script>
<div ng-app="myApp">
<div ng-controller="myCtrl">
<table cellspacing="0" cellpadding="5" border="2">
<tr>
<th ng-click=" columnToOrderBy ='Date'; descending = !descending">
Date
</th>
<th ng-click=" columnToOrderBy ='Location'; descending = !descending">
Location
</th>
</tr>
<tr ng-repeat="item in data | orderBy:columnToOrderBy:descending">
<td>{{item.date | date:"MM/dd/yyyy h:mma"}}</td>
<td>{{item.Location}}</td>
</tr>
</table>
</div>
</div>