You can't use d
in orderBy
, because this variable doesn't exist when the filter is applied : the array is first filtered, and only then is "repeated".
You must sort the array by each item's actual value. See this question:
$scope.identity = angular.identity;
$scope.dates = [new Date(2013, 0, 1), new Date(2013, 2, 1), new Date(2013, 1, 1)];
<div ng-repeat="d in dates | orderBy:identity:true" ng-bind="d | date:'medium'"></div>