0

angularjs -slider应显示不带逗号的值,并且仅在最小最大值上显示逗号值。示例: [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]

我该如何设置?

4

1 回答 1

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]
        }
    }
}

提琴手:http: //jsfiddle.net/w3ve98eL/1/

于 2016-10-05T15:07:01.453 回答