app.controller('rawCtrl', ['$scope', '$http', function ($scope, $http) { $scope.update = function() { $http.get('back/list/raw').success(function(data) { $scope.rawlist = data.list.filter(function(f) { return (f.date === +f.date) //Check if it's a number }).map(function(f) { var item = f; item.date = item.date*1000; return item; }).sort(function(a,b) { return ( b.date > a.date ? 1 : -1 ); }); }); }; $scope.update(); }]);