Created
May 7, 2015 04:20
-
-
Save martianyi/c13379ae061a5ff8af9e to your computer and use it in GitHub Desktop.
range filter using with angular rangeslider
This file contains hidden or 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
app.filter('rangeFilter', function () { | |
return function (items, sliderRanges) { | |
var filtered = []; | |
var expectedReturnMin = sliderRanges.expectedReturnMin; | |
var expectedReturnMax = sliderRanges.expectedReturnMax; | |
var durationMin = sliderRanges.durationMin; | |
var durationMax = sliderRanges.durationMax; | |
angular.forEach(items, function (item) { | |
if (item.expected_return >= expectedReturnMin && item.expected_return <= expectedReturnMax && item.duration >= durationMin && item.duration <= durationMax) { | |
filtered.push(item); | |
} | |
}); | |
return filtered; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment