Closed ghost closed 10 years ago
first thank you @melonista, as it is always tricky to integrate such a big stuff ;)
nice idea I will check what can be done.
but as it will probably trigger many events, maybe it will be an option to put at init phase.
I give you details soon
Thanks for your fast reply, I will use it as it is and I will stay tuned for future updates.
@melonista You can link up the onstatechange callback that the jQuery plugin already offers and it just works.
Has anyone else been able to make onstatechange work? I have the following options:
$scope.sliderOptions = {
from : 0
, to : 255
, step : 1
, onstatechange : function(value) { console.log('new value is: ' + value)}
}
with the following line in my angular app (using a jade template)
input(ng-model="light.pwmValue", type='text', id='mySlider{{$index}}', slider options='sliderOptions')
and the function isn't being called. Am I missing something fundamental?
hi @xqjibz , i am not sure to get time to figure out what's happening today, can you try to force id with no dynamic $index first ?
OK, I tried that, that did not work. I found this: https://github.com/darul75/ng-slider/blob/master/src/ng-slider.js#L78-L79 and that seems to be missing the onstatechange. What I did here is:
if (scope.options.calculate)
OPTIONS.calculate = scope.options.calculate;
if (scope.options.onstatechange)
OPTIONS.onstatechange = scope.options.onstatechange;
What I do not know, is if this is the proper way to fix this or not, or if this is the way you had originally intended for this to work.
If you're amenable, I'd be more than happy to put in a PR, and/or open a new issue or something to clarify this a bit more.
yeah that is the solution for sure, do not hesitate to make a PR to fix it
Hi,
Thanks a lot for sharing this useful module.
I would like to get the value updated as the slicer is moving. So far I have been only able to get the selected value once the user has released the slider. Is there any simple way to have the selected value updated dynamically in the scope of my controller?
Thanks!