2
I have this slider:
<md-slider step="5" min="15" max="120" ng-model="tempo" aria-label="red" id="red-slider" class="">
</md-slider>
I could not find a legal way to know when the user changes the slider, I worked this way:
$scope.tempo = 25;
$scope.tempo_final = '15 Min';
$scope.$watch(
function(tempo) {
console.log($scope.tempo);
}
);
But the return of this function is not interesting, even more that I will throw this value in bank, so would have some way to know when this slider is amended?
Use the Angularjs v1.3.15 if you specify another version for this method, I can change.
Already tested this way, it does not call the ng-change method :(
– Shelon
Nor with the Blur?
– celsomtrindade
It also does not accept.
– Shelon
You have to see how the Material deals with this type of interaction. But what is the return of the $watch you got?
– celsomtrindade
@Shelon updated my answer, see the direct example of Angularmaterial, it is working.
– celsomtrindade
In this example if I remove the change and direct print the ng-model time the action will be the same. I didn’t use the watch because it keeps following every move of the slider, that is when I change the number 20 to 150 it does 130 actions theoretically, so it is not feasible for the application I am trying to do. Just need it to show the final value, when the user finished the interaction with the Object, in Dragand.
– Shelon
Yes, I did. But did you see that I updated the answer? There it is working. There must be something in your code blocking ng-change, or you didn’t set it right. Have you checked there?
– celsomtrindade
Yes, but in this example he sends every time the number is changed a request, that is while dragging the slider, he would send to me the number that is passed in the slider. I need you to send it when I stop the slider, not when I’m changing it.
– Shelon
@Shelon Switch to
ng-blur
, see: http://codepen.io/anon/pen/obgVMG– celsomtrindade