Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Double-Display of Value When Range Is a Single Value #245

Closed
@eriksendc

Description

@eriksendc

Hi All,

I have a case where I'm using the slider like this:

<rzslider rz-slider-model="activityLevelSlider.min" rz-slider-high="activityLevelSlider.max" rz-slider-options="activityLevelSlider.options"></rzslider>

I set up the slider in my controller like this:

    $scope.activityLevelSlider = {
        min: 1,
        max: 3,
        options: {
            floor: 1,
            ceil: 3,
            translate: function (value) {
                switch (value) {
                    case 1: return 'low';
                    case 2: return 'average';
                    case 3: return 'high';
                }
            }
        }
    };

The 2.6.0 behavior was showing "low - low" for example, when both ends of the range were on 1. I dug into rzslider.js and found updateCmbLabel: function() {.... In there was a line of code like this:

this.translateFn(lowTr + ' - ' + highTr, this.cmbLab, false);

I wrapped that in an if like this:

      if (lowTr === highTr) {
          this.translateFn(lowTr, this.cmbLab, false);
      } else {
          this.translateFn(lowTr + ' - ' + highTr, this.cmbLab, false);
      }

I'm a total newbie at contributing and don't really know how to use git or github yet. I'll try to do some learning about that so I can contribute myself. But I thought I'd post this here in the meantime.

Thanks,
Brian Eriksen

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions