CodeGeeky
CodeGeeky

Reputation: 453

Passing data to angular function on changing html slider input

I want to pass a value on changing the html slider input in AngularJs.

<input type="range" value="30" min="0" max="0" id="set-value" />

Angular function:

$scope.passValueHere = function(value) {
  //TODO Here
}

I don't want to use any plugins or whatever. Just a simple answer. Thanks. :)

Upvotes: 1

Views: 1619

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136154

1st thing you need to use ng-model directive with value, which will be available in controller $scope & then place ng-change event over that input element.

Markup

<input type="range" value="30" min="0" max="0" id="set-value" 
  ng-model="sliderModel" ng-change="passValueHere(sliderModel)"/>

Upvotes: 1

Related Questions