0

Here i want to get the sliderValue in onchange event of javascript function. Currently I am using document.queryselector instead of i want to set it in scope of sliderValue.

Code: <input id="slider" type ="range" min="{{sliderMin}}" onchange="updateSlider()" max="{{sliderMax}}" step="{{sliderStep}}" value="{{sliderValue}}" />

4
  • Try ng-change="updateSlider(sliderValue)" Commented Jun 19, 2015 at 12:56
  • Can't you use ng-change instead of onchange? Commented Jun 19, 2015 at 12:56
  • yes i tried ng-change but it not working properly in all browser getting struck in firefox. Commented Jun 19, 2015 at 12:57
  • It should work. What's wrong with firefox ? Commented Jun 19, 2015 at 16:30

2 Answers 2

2

Try this:

onchange="angular.element(this).scope().updateSlider(this)"
Sign up to request clarification or add additional context in comments.

Comments

0

I can't agree with Sid response. Angular best practice is to use ngchange:

<input id="slider" type ="range" min="{{sliderMin}}" ng-change="updateSlider(sliderValue)" 
max="{{sliderMax}}" step="{{sliderStep}}" value="{{sliderValue}}" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.