From 128d371534f7c47b91269baaefd100b8e8a4a7ec Mon Sep 17 00:00:00 2001 From: Jan Beckert Date: Fri, 24 Aug 2018 23:13:34 +0200 Subject: [PATCH] Fixes simultaneously changing range values outside current range results in only one value being changed Fixes #1 --- ionic-range-slider.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ionic-range-slider.js b/ionic-range-slider.js index 9455814..e2d9c29 100644 --- a/ionic-range-slider.js +++ b/ionic-range-slider.js @@ -126,17 +126,29 @@ angular.module("ion.rangeslider").directive("ionRangeSlider", watchers.push($scope.$watch('from', function(value) { var slider = $element.data("ionRangeSlider"); if (slider.old_from !== value) { - slider.update({ - from: value - }); + + if(value <= slider.old_to) { + slider.update({ + from: value + }); + } else { + slider.update({from: value, to: value}); + } + } })); watchers.push($scope.$watch('to', function(value) { var slider = $element.data("ionRangeSlider"); if (slider.old_to !== value) { - slider.update({ - to: value - }); + + if(value >= slider.old_from) { + slider.update({ + to: value + }); + } else { + slider.update({from: value, to: value}); + } + } })); watchers.push($scope.$watch('disable', function(value) {