Skip to content
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

how to get the handle value on mouse move? #6

Open
gaurav5430 opened this issue Oct 14, 2017 · 2 comments
Open

how to get the handle value on mouse move? #6

gaurav5430 opened this issue Oct 14, 2017 · 2 comments

Comments

@gaurav5430
Copy link

gaurav5430 commented Oct 14, 2017

I am able to read the slider handle values using the mouse up event... but i can't find a way to read the value while the handle is being dragged. I am certainly missing something, as i can see the values updating as i move the handles on your demo page. how can i achieve this?

For example, i have a 2 handle slider, and i want to call some code as soon as any 1 of them is dragged and while it is being dragged, so effectively as soon as the value changes. (One way i can think of is to watch the slider variable in my controller)

@emadera
Copy link
Contributor

emadera commented Oct 15, 2017

You should be able to read the handle values using the array you bound to slider-handle-variable. In general, this is the preferred method; the events are intended more as a backup alternative.

For example, if you make a 2-handled slider and set
$scope.myHandles = [0, 100] in your controller before the slider is built and

slider-handle-variable = 'myHandles' in your html where you call the directive,

then when the slider is initialized the handles will be placed at 0 and 100.

From then on, $scope.myHandles[0] will reflect the first handle's value and $scope.myHandles[1] will hold the second's.

@gaurav5430
Copy link
Author

yeah, but is there an some kind of event while a slider handle is being dragged ? i know when any of them is being dragged the $scope.myHandles[0] or $scope.myHandles[1] would change, and i can $watch them in my scope , to call any function whenever the handle value changes, but this would also get called when the handles are not actually being dragged, but the value is changed from any of the other methods (using any of the ways to set handle values)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants