Last active
January 15, 2016 12:36
-
-
Save alex-wilmer/2ff92c72af4c1cb45ca8 to your computer and use it in GitHub Desktop.
Angular Filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dateRange () { | |
return function(items, from, to) { | |
if (items != null) { | |
var inRange = []; | |
angular.forEach(items, function(item) { | |
if (from < item.created && item.created < to) { | |
inRange.push(item); | |
} | |
}); | |
return inRange; | |
} | |
} | |
} | |
function beforeToday() { | |
return function(items) { | |
if (items != null) { | |
var filtered = []; | |
angular.forEach(items, function(item) { | |
if (item.date < new Date()) { | |
filtered.push(item); | |
} | |
}); | |
return filtered; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment