I am trying to make a simple AngularJS app:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body ng-app="myApp">
<div ng-controller="mainController">
Order by column: <select ng-model="columnName">
<option value="+name">Name ASC</option>
<option value="age">Age ASC</option>
<option value="-salary">Salary DESC</option>
</select>
<br/>
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="employee in employees | orderBy:columnName">
<td>{{ employee.name }}</td>
<td>{{ employee.age }}</td>
<td>{{ employee.salary }}</td>
**<td>{{ employee.salary }}</td>**
</tr>
</tbody>
</table>
</div>
<script src="angular.min.js"></script>
<script src="jquery-1.11.3.js"></script>
<script src="app.js"></script>
</body>
</html>
AngularJS:
var app = angular.module('myApp', []);
app.controller('mainController', ['$scope',function($scope) {
var employees1 = [
{name: 'Jim', age: 18, salary: 4500, DOB: new Date("November 18th, 2009")},
{name: 'Joe', age: 18, salary: 4000, DOB: new Date("November 18th, 2012")},
{name: 'Bob', age: 20, salary: 6000, DOB: new Date("November 18th, 2004")},
{name: 'Rob', age: 45, salary: 1800, DOB: new Date("November 18th, 2001")}
];
$scope.employees = employees1;
$scope.columnName = '+name';
}]);
EDIT:
I added the Date objects in my employee array and when I try to print them out in the ng-repeat in the tr it keeps giving me null for the date column: