angular-slider / ngx-slider

Self-contained, mobile friendly slider component for Angular based on angularjs-slider
https://angular-slider.github.io/ngx-slider/
MIT License
387 stars 175 forks source link

Conditionally show high value #84

Open HellooooNewman opened 5 years ago

HellooooNewman commented 5 years ago

Trying to conditionally use the high value based on a truth or false condition. Worse comes to worse I have two templates, one with the high value excluded but that's not preferable.

Here's the current template

<ng5-slider
        [(value)]="value"
        [(highValue)]="maxValueLabel ? null : maxValue"
        [options]="options"
        (userChange)="onUserChange($event)"
></ng5-slider>

Options config

this.options = {
      floor: 0,
      ceil: this.maxValue,
      keyboardSupport: true,
      showSelectionBar: this.showSelectionBarEnd ? false : true,
      step: 1000,
      hideLimitLabels: true,
      noSwitching: true,
      disabled: this.disabled,
      showSelectionBarEnd: this.showSelectionBarEnd
    }
piotrdz commented 5 years ago

Currently the slider code contains some checks for switching between simple and range slider in runtime, but there is no telling how functional they still are, given that much has changed since the angularjs rewrite.

Instead, I was hoping to go in opposite direction in the future: split the single component into two separate components: simple slider with single input and range slider with the two inputs. This would help keep the code more organised and eliminate friction between different features of simple vs range slider, which is already causing some headaches.

HellooooNewman commented 5 years ago

Sounds like a good plan to me. 👌