I am trying to implement AngularJS slider bar from Google search, I can bale to filter it out based on my slider selection, but I am unable to display the it's minimum and maximum range values at the starting and ending of the slider bar(on top or at starting/ending places of slider bar).
Like sample:
If I give like: <slider floor="0" ceiling="50" ng-model-low="lower_price_bound" ng-model-high="upper_price_bound"></slider>, then my slider is filtering fine(of course it won't show any range values on top of slider bar)
But If I give like: <slider floor="0" ceiling="50" ng-model-low="lower_price_bound" ng-model-high="upper_price_bound" ng-model="itemrange.maxvalue"></slider> then my filtering is not working based on my slider moving/selection, I hope this time it also should show the range values(at starting and ending places of slider bar, but it's not happening ?, here we are adding: ng-model="itemrange.maxvalue")
Fiddle is available.
html:
<body ng-controller='PriceCtrl'>
<slider floor="0" ceiling="50" ng-model-low="lower_price_bound" ng-model-high="upper_price_bound" ng-model="itemrange.maxvalue"></slider>
lower_price_bound: <strong>{{lower_price_bound}}</strong>
upper_price_bound: <strong>{{upper_price_bound}}</strong>
<hr>
<table border="1">
<thead>
<th>Name</th>
<th>Min Price</th>
<th>Max Price</th>
</thead>
<tbody>
<tr ng-repeat='item in items|filter:priceRange'>
<td>{{item.name}}</td>
<td>{{item['min-acceptable-price']}}</td>
<td>{{item['max-acceptable-price']}}</td>
</tr>
</tbody>
</table>
</body>
app.js:
var app = angular.module('prices', ['uiSlider']);
app.controller('PriceCtrl', function ($scope){
$scope.itemrange = {
maxvalue: 50
};
$scope.items = [{name: "item 1", "min-acceptable-price": "10",
"max-acceptable-price": "50"},
{name: "item 2", "min-acceptable-price": "5",
"max-acceptable-price": "40"},
{name: "item 3", "min-acceptable-price": "15",
"max-acceptable-price": "30"}];
$scope.lower_price_bound = 0;
$scope.upper_price_bound = 50;
$scope.priceRange = function(item) {
return (parseInt(item['min-acceptable-price']) >= $scope.lower_price_bound && parseInt(item['max-acceptable-price']) <= $scope.upper_price_bound);
};
});
Please let me know where and what I am doing wrong ? Thanks in advance.
