Angular rangeSlider - update

233 views Asked by At

I use rangeSlider for filter according to price. I need to make reset button, to set this slider to its default values.

My HTML

<div class="col-md-2 col-xs-12">
  <div class="col-nav-center">
    <div class="middle-filter-slider">
      <input type="text" class="rangeJs" value="" name="range"/></div>
    </div>
  </div>
</div>

Initialize slider

function initRangeSlider(min, max) {
  $(".rangeJs").ionRangeSlider({
    hide_min_max: false,
    keyboard: true,
    min: min,
    max: max,
    from: min,
    to: max,
    type: 'double',
    step: 1,
    postfix: " eur",

    onStart: function(data) {},
    onChange: function(data) {},
    onFinish: function(data) {
      $scope.filter.priceFrom = data.from;
      $scope.filter.priceTo = data.to;
      priceFactory.requestPrices(null, null, $scope.filter);
    },
    onUpdate: function(data) {
      $rootScope.slider.reset();
    }
  });

  $rootScope.slider = $(".rangeJs").data("ionRangeSlider");
}

Function for update

$rootScope.slider.update();

When I click on update-button, function update is calling. It updates the values, and returns me all items. It´s fine, but problem is that slider(view) doesn´t set to init (default) state.

enter image description here

0

There are 0 answers