Search code examples
angularjssliderangularjs-slider

angularjs-slider Values without commas


The angularjs-slider should display values without commans, and only on the min max values display comma values. Example: [6.5, 7, 8, .... , 31, 31.5]

If I set

$scope.slider = {
  value: 31.5,
  options: {
    floor: 6.5,
    ceil: 31.5,
    step: 1,
    precision: 1
  }
};

the values are [6.5, 7.5, 8.5 ... 31.5]

How can I set this?


Solution

  • Found it: i have to set the stepsArray option, with the values I want to select.

    Example:

    var myApp = angular.module('myapp', ['rzModule']);
    
    myApp.controller('TestController', TestController);
    
    function TestController() {
        var vm = this;
    
        vm.priceSlider = {
            value: 31.5,
            options: {
                floor: 6.5,
                ceil: 31.5,
                step: 1,
                precision: 1,
                stepsArray: [6.5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31.5]
            }
        }
    }
    

    Fiddler: http://jsfiddle.net/w3ve98eL/1/