darul75 / angular-awesome-slider

:arrows_clockwise: Angular slider control directive
http://darul75.github.io/angular-awesome-slider/
MIT License
144 stars 63 forks source link

patch to add callback function on mouse up and pass HTML element as argument #28

Closed liviu-vasut closed 9 years ago

liviu-vasut commented 10 years ago

Hi, I'm using ng-slider on a project where I update a led's light intensity with the value of a slider. Since ng-slider only provides onstatechange() (which is called many times per second and would flood the communication channel to the hardware) I added a callback function to be called only when the user is releasing the slider pointer. This callback function can be set as "options.callback".

I also needed a reference to the HTML element that holds the slider in case I have more than one slider (e.g. in a ng-repeat) so I can update the background color to match the values selected on the sliders. For this, I added the element as a parameter to both functions (callback and onstatechange).

For those interested I made a patch. I can attach only images (?!), and markdown is messing it up, so get it here: https://app.box.com/s/txgszkd5kb2e7oh4jnam

darul75 commented 10 years ago

Hi,

If you get time, do not hesitate to put a PR and I will merge it after having made few tests.

Thx

liviu-vasut commented 10 years ago

Done