JavaScript Bind input to 2 variables with one getting updated through ng-model-options input bind variables

I'd like to bind 2 Angular model variables to a range input element according to the following:

  • update first model variable for every change of the range input
  • update second model variable after x ms of the last range input change / on blur using ng-model-options

The first model variable is used to display the current range value in a label element.

The second model variable is used to trigger UI updates. To prevent slowness, it therefore has to be updated less often.

Does someone know how to do that?

Code for input and label elements where the first model variable is rangeIndex.

<input id="range-slider" type="range" min="0" max="{{rangeList.length-1}}" ng-model="rangeIndex">

<label for="range-slider">{{rangeList[rangeIndex] | range}}</label>
Answer:1

You can't bind 2 variables to a single input. If you need such behavior, you should consider the following solution:

  1. Create a getter/setter and use then in the options (see example here).
  2. Define a debounced function using lodash _.debounce.
  3. In your getter/setter, update the relevant value and invoke the debounced method.
Answer:2

Given two points: const point1 = {x: 100, y: 0.95} const point2 = {x: 75, y: 1.05} I need to know the value of y when x equals some arbitrary value. Please assume a linear relationship exists. For ...

Given two points: const point1 = {x: 100, y: 0.95} const point2 = {x: 75, y: 1.05} I need to know the value of y when x equals some arbitrary value. Please assume a linear relationship exists. For ...

  1. function point line of code
  2. point function line
  3. function point and line of code difference

I am trying to get an input box to be disabled when a checkbox is checked. I'm trying to use Knockoutjs to get this done, but it doesn't seem to work. Here is my html: <input id="input1" type="...

I am trying to get an input box to be disabled when a checkbox is checked. I'm trying to use Knockoutjs to get this done, but it doesn't seem to work. Here is my html: <input id="input1" type="...

  1. knockout js disabled binding
  2. knockout js disable binding

I'm trying to send characters to an input element based on user actions. I'm trying to use KeyboardEvent with dispatchEvent but whatever I do, it doesn't work For example: let keyEvent = new ...

I'm trying to send characters to an input element based on user actions. I'm trying to use KeyboardEvent with dispatchEvent but whatever I do, it doesn't work For example: let keyEvent = new ...

I want to find all word which start with mc and followed by all digits only var myString="hi mc1001 hello mc1002 mc1003 mc1004 mc mca" Require output = [ mc1001,mc1002,mc1003,mc1004] My solution: ...

I want to find all word which start with mc and followed by all digits only var myString="hi mc1001 hello mc1002 mc1003 mc1004 mc mca" Require output = [ mc1001,mc1002,mc1003,mc1004] My solution: ...

  1. find word start with
  2. how to find word startup folder
  3. word finder start with u
  4. find word start with st
  5. find word start with sc
  6. find word start with gl
  7. find word start with sh
  8. find word start with air
  9. find word start with cou
  10. find word start with bri
  11. find word start with qua
  12. find word starting with regex
  13. find word starting with python
  14. find word starting with x
  15. find word starting with hash
  16. find word starting with k
  17. find word starting with play
  18. word find start of line
  19. word finder start with c
  20. word finder start with v