tb / ng2-nouislider

Angular2 noUiSlider directive
http://tb.github.io/ng2-nouislider/
MIT License
184 stars 114 forks source link

Why Min Max cannot be same? how to turn off this validation #114

Open rammohan201 opened 7 years ago

rammohan201 commented 7 years ago

Hi, is there a way to remove min and max cannot be same validation? assume there is only result after applying certain filters in that case min max can be same.

marzn commented 7 years ago

I have the same problem, has anyone a solution for this?

kiqq commented 7 years ago

Could You explain more precisely what is Your problem. Are You sure You are using slider properly, like this:

<nouislider [config]="sliderConfig"></nouislider>

  public sliderConfig: any = {
    start: [30, 30],   //starting position for each handle, more elements - more handles
    range: {           //the range in which handles can operate 
      'min': 0,        //beginning value for slider
      'max': 100       //end value for slider
    }
  };

When min and max are equal there is no range between - no sense to create or use slider. You can set disabled="true" attribute in nouislider tag if You want to freeze handles.

jaripekkala commented 6 years ago

Example when you have a price range filter for a list of items.

min = the cheapest item in the list max = the most expensive item

screen shot 2018-05-18 at 11 43 38 am

When there is only one item in the list the min and max range values are the same. Maybe the user filtered the list by item's name or something.

In that case the wanted behavior would be as below without ability to move the handlers.

screen shot 2018-05-18 at 11 41 28 am

thepercival commented 5 years ago

yes, totally agree. when min and max are the same, the slider should not be able to slide