angularjs-slider
angularjs-slider copied to clipboard
Default values for range slider with stepsArray
See my range slider here?

I'm using a stepsArray that contains dates, and each step is a single day:
$scope.slider = {
minValue: 0,
maxValue: 1,
options: {
stepsArray: getAllDays(),
noSwitching: true,
translate: function(value, sliderId, label) {
switch (label) {
case 'model':
return '<b>Start date:</b> ' + value;
case 'high':
return '<b>End date:</b> ' + value;
case 'floor':
return '<b>Min date:</b> ' + value;
case 'ceil':
return '<b>Max date:</b> ' + value;
}
}
}
};
I wish to start the slider on default with the max range, but it starts with both handles on the first date. Is there any way to pass the first and last dates to the minValue and maxValue?
Yes you just need to set these values in your $scope.slider object... If your getAllDays() returns an array, extract it before the slider config in a var and set minValue to var[0] and maxValue to var[var.length -1].
It works. I'll close it. Thanks.