Angular md-slider, data transmission to JS function
-
There's a slider on the angular'e:
<div style="width: 200px;"> <md-slider flex min="0" max="260" ng-model="tax[id]" id="tax[id]" class></md-slider> <input flex type='number' ng-model="tax"> </div>
Can you tell me how the slider data (number) refer to JS? The superintendent? I need to act on a slider shift. Considering that
ng-model="tax[id]"
id="tax[id]"
♪id
random numbers.
-
I don't quite understand what "when ng-model="tax[id]" id="tax[id], id random numbers."
Make a normal ng-model, let's point to the correct object inside the controller.
ng-model='sliderVal'.
Add ng-change directive to slider. In ng-change, call the angular-control method.
ng-change='onSliderChange()'
Slider data will be available in sliderVal.
console.log($scope.sliderVal);