2

I'm trying to edit the rz-slider's labels that appear below the ticks. I am able to obtain the values and everything but if I try to update the stepsArray to the rzslider, it is not being updated. I couldn't find anything on how to update the legend values like this. I feel like I need to reinitialize or refresh the slider in some way but the refresh slider code as shown in https://github.com/angular-slider/angularjs-slider did not work:

vm.refreshSlider = function () {
    $timeout(function () {
        $scope.$broadcast('rzSliderForceRender');
    });
};

I am trying to update the "Text" to 1-2-3 just to check if it can work

The code that I am using is as follows. Currently the existing legend contains the word "Text" and I am just trying to check if I can update it to the numeric values just to check if it works but it isn't:

if(vm.legend != ""){
   var stepCount = $("#stepCount").val();
   vm.priceSlider.options.stepsArray = [];
   for(var i = 1; i <= stepCount; i++){
      vm.priceSlider.options.stepsArray.push({
        value: i,
        legend: i.toString()
      });
    }
    vm.refreshSlider();
  }

I am kinda new to angular and this is my first time working with the rzslider as well, so any help would be appreciated. Thank you.

NcDreamy
  • 785
  • 6
  • 14

0 Answers0