Venturocket / angular-slider

Slider directive for AngularJS.
MIT License
262 stars 121 forks source link

Slide completed event #43

Closed bradgreens closed 10 years ago

bradgreens commented 10 years ago

Maybe I'm missing this due to the sparse documentation. Is there a slide completed event which would contain the model/position value(s) of the slider?

I tried doing $scope.$watch( 'slider.model', fct ) but it fires while the user is actively sliding. I need to run a test when the slide operation is entirely complete (specifically after the directive runs the updateDOM code.

bradgreens commented 10 years ago

As an example of my temporary solution, I add scope.$emit('slideCompleted', scope.ngModel); to the bottom of the onEnd function to give myself a callback.

bradgreens commented 10 years ago

Ok I figured out the "right" way. In my case I went with - ng-change="handleSliderChange(slider.model)" where handleSliderChange and slider.model are both available on the current scope.