<!DOCTYPE html>
<html>
<head>
<script src="Scripts/angular.min.js"></script>
<style>
table, th, td
{
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd)
{
background-color: #ffe6e6;
}
table tr:nth-child(even)
{
background-color: #ccffcc;
}
</style>
</head>
<body style="font-family:Arial; font-size:medium; color:darkblue">
<div ng-app="myModule" ng-controller="employeeCtrl">
<h2>date and orderBy filter in AngularJS:</h2>
<table>
<tr>
<th>Employee Name</th>
<th>Date of Birth</th>
<th>Address</th>
</tr>
<tr ng-repeat="e in Employee | orderBy:'address'">
<td>{{e.empName}}</td>
<td>{{e.DOB|date:"dd/MM/yyyy"}}</td>
<td>{{e.address}}</td>
</tr>
</table>
</div>
<script>
var myApp = angular.module("myModule", []);
myApp.controller('employeeCtrl', function ($scope) {
$scope.Employee = [
{
empName: 'Raj',DOB:new Date('04-05-76'), address: 'Pune'
},
{
empName: 'Digvijay', DOB:new Date( '14-April-80'), address: 'USA'
},
{
empName: 'Jon', DOB:new Date( '10-October-79'), address: 'England'
},
{
empName: 'Shyam', DOB:new Date( '04-05-1980'), address: 'Nagpur'
},
{
empName: 'Ram', DOB: new Date('04-05-76'), address: 'Newyork'
},
{
empName: 'Arvind', DOB:new Date( '04-05-76'), address: 'Patna'
},
{
empName: 'Zen', DOB:new Date( '04-05-82'), address: 'USA'
},
{
empName: 'Shiva', DOB: new Date('04-05-2001'), address: 'England'
}
];
});
</script>
</body>
</html>