Skip to content

Instantly share code, notes, and snippets.

@jameshwang
Created January 27, 2014 05:03
Show Gist options
  • Save jameshwang/8643520 to your computer and use it in GitHub Desktop.
Save jameshwang/8643520 to your computer and use it in GitHub Desktop.
Custom filters in AngularJS
angular.module('datePickerFilter', [])
.filter('greaterThanDate', ['$filter', function($filter) {
return function(rows, date) {
return $filter('filter')(rows, function(row) { return row.occurredAt > date });
};
}])
.filter('lessThanDate', ['$filter', function($filter) {
return function(rows, date) {
return $filter('filter')(rows, function(row) { return row.occurredAt < date });
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment