angularjs-slider没有逗号的值

时间:2016-10-05 15:02:13

标签: angularjs slider angularjs-slider

$onInit and require应显示没有commans的值,并且仅在最小值上显示逗号值。 示例:[6.5,7,8,....,31,31.5]

如果我设置

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

值为[6.5,7.5,8.5 ...... 31.5]

我该如何设置?

1 个答案:

答案 0 :(得分:0)

找到它:我必须使用我想要选择的值设置stepsArray选项。

示例:

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/