Wildhoney / ngRangeSlider

Multi-handle range slider utilising the native HTML5 input range elements.
http://ng-range-slider.herokuapp.com/
MIT License
55 stars 11 forks source link

min/max update and ng-model scoping problem #5

Closed erhhung closed 9 years ago

erhhung commented 9 years ago

Thanks for creating a composite slider solution. It generally works well, but I've had to work around a couple issues:

  1. min/max attributes assigned to scope variables that are later changed don't actually result in changes to the slider limits as you stated it should.
  2. because of ♯1, I cannot use the slider element with ng-show, as I don't want to initially display the range slider and don't have the min/max values until I want to show the slider.
  3. because of ♯2, I resorted to using ng-if, which evaluates to true at the same time I determine the appropriate min/max and initial from/to values. However, as ng-if creates a child scope, I had to use $parent in the <section ng-model> (but I don't have to in the <label>--see below).
<div ng-if="showSlider">
  <section data-range-slider class="range-slider"
           min="limits.min" max="limits.max"
           ng-model="$parent.range">
  </section>
  <label>{{range | json}}</label>
</div>

I would like to use ng-show and dynamically update min/max values, but if I choose ng-if, ng-model should reference the variable in the parent scope like other elements.

Wildhoney commented 9 years ago

Please try 0.1.9, Erhhung... :+1: