From 13a85ba9cf542cb00e3a40a7d38c1136643b2ad4 Mon Sep 17 00:00:00 2001 From: Dominik Greibl Date: Fri, 11 May 2018 10:39:39 +0200 Subject: [PATCH] fix slider jumps to first value if value is not in stepsArray --- src/rzslider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rzslider.js b/src/rzslider.js index ef90363..cc17980 100644 --- a/src/rzslider.js +++ b/src/rzslider.js @@ -450,7 +450,9 @@ var index = 0 for (var i = 0; i < this.options.stepsArray.length; i++) { var step = this.options.stepsArray[i] - if (step === modelValue) { + var lastStep = i > 0 ? this.options.stepsArray[i - 1] : 0; + + if (step === modelValue || (modelValue > lastStep && modelValue < step)) { index = i break } else if (angular.isDate(step)) {