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.


  • QA Engineer

    I don't quite understand what "when ng-model="tax[id]" id="tax[id], id random numbers."

    1. Make a normal ng-model, let's point to the correct object inside the controller.

      ng-model='sliderVal'.

    2. Add ng-change directive to slider. In ng-change, call the angular-control method.

      ng-change='onSliderChange()'

    3. Slider data will be available in sliderVal.

      console.log($scope.sliderVal);




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2