Here is my code
/// <reference path="angular.min.js" />
var myApp = angular.module("myModule", []).controller("myController", function($scope) {
var employees = [{
name: "Ben",
dateOfBirth: new Date("November 23,1980"),
gender: "Male",
salary: 55000.788
}, {
name: "Sara",
dateOfBirth: new Date("May 05,1970"),
gender: "Female",
salary: 68000
}, {
name: "Mark",
dateOfBirth: new Date("August 15,1974"),
gender: "Male",
salary: 57000
}, {
name: "Pam",
dateOfBirth: new Date("October 27,1979"),
gender: "Female",
salary: 53000
}, {
name: "Todd",
dateOfBirth: new Date("December 30,1983"),
gender: "Male",
salary: 60000
}];
$scope.employees = employees;
$scope.sortColumn = "name";
$scope.reverseSort = false;
$scope.sortData = function(column) {
$scope.reverseSort = ($scope.sortColumn == column) ? !$scope.reverseSort : false;
$scope.sortColumn = column;
}
$scope.getSortClass = function(column) {
if ($scope.sortColumn == column)
return $scope.reverseSort ? 'arrow-down' : 'arrow-up';
return '';
}
});
I just want to ask that are employees,sortColumn and reverse sort are separate models or they belong to one model and what are the sortData and getSortClass in this files are they behavior in our model please explain...Thanks in advance.