I am trying to create a filter for AngularJS data. I have 2 inputs, minAgeInput and maxAgeInput.
I would like to return all products/objects (with ng-repeat), where the product's minAge and maxAge are within the boundaries set by the input values.
My filter function looks like this:
or link to Plunker
$scope.ageRange = function (plane) {
var minAgeProduct = parseFloat(product.minAge);
var maxAgeProduct = parseFloat(product.maxAge);
var minAgeInput = parseFloat($scope.minAge);
var maxAgeInput = parseFloat($scope.maxAge);
if(minAgeInput >= minAgeProduct) {
if(maxAgeInput <= maxAgeProduct) {
return true;
} else {
return false;
}
return true;
} else {
return false;
}
};