简体   繁体   English

角度ui滑块-动态最小值/最大值

[英]Angular ui-slider - dynamic min/max values

I'm using the angular ui-slider, and I need to load the slider's min- and max values from an external source so that I can set them like this: 我正在使用角度ui滑块,并且需要从外部源加载滑块的最小值和最大值,以便可以这样设置它们:

$scope.minMaxValues = {
      slider1: {
        min: 0,
        max: 200
      },
      slider2: {
        min: 0,
        max: 200
      },
      slider3: {
        min: 0,
        max: 200
      },
      slider4: {
        min: 0,
        max: 200
      },
      slider5: {
        min: 0,
        max: 200
      }
    };

My HTML-looks like this: 我的HTML看起来像这样:

<div class = "ui-slider-range ui-slider-handle" ui-slider="{range: true}" min="minMaxValues.slider1.min" max="minMaxValues.slider1.max" step="0.01" use-decimals ng-model="sliderValues[0]"></div>

Any suggestions on how to do this would be appreciated. 任何建议如何做到这一点将不胜感激。

由于ui-slider在该指令上使用属性,因此您需要传递实际值:

<div class = "ui-slider-range ui-slider-handle" ui-slider="{range: true}" min="{{minMaxValues.slider1.min}}" max="{{minMaxValues.slider1.max}}" step="0.01" use-decimals ng-model="sliderValues[0]"></div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM