-
-
Notifications
You must be signed in to change notification settings - Fork 497
Question: How can create array of steps? #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can do this by using a custom translate function. The slider will be picking an index of your array and you will need to handle the link with the array. <rzslider
rz-slider-floor="yourSlider.floor"
rz-slider-ceil="yourSlider.ceil"
rz-slider-model="yourSlider.model"
rz-slider-translate="translate"></rzslider> var yourValues = [10, 25, 50, 80, 1000]; //obviously heterogeneous
$scope.yourSlider = {
value: 0,
floor: 0,
ceil: yourValues.length - 1,
step: 1
};
$scope.translate = function(index)
{
if(index >= 0 && index < yourValues.length)
return yourValues[index];
return ''; //error case
}; then to get the selected value (you can set a watch to react on each change or use this #67 if it gets merged) var selectedValue = yourValues[$scope.yourSlider.value]; |
Thank you |
How could I output a string value |
Sorry but I don't understand what you want... |
Sorry, I'll attempt to explain a different way... Currently, the 'Simple Slider' displays its value in the 'Model: I want to create the same for the 'Alphabet Slider' where there is no 'Model:' box? How would i do this? |
Hmm you can't do this since the value handled by the slider in this case is an index in an array, not the displayed value. |
Oh ok, thank you for your time anyway. |
Getting the array value is easy, just access it with the index. The problem is to bind it to a text input... |
Hi.
Can you explain to me. How I can create an array of steps.
For example I have this code:
$scope.sensitivity = {
min: 10,
max: 50,
default: 10
};
I need fixed points like [10----20----50].
How can I do this?
The text was updated successfully, but these errors were encountered: