question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with onChange in ng-repeat

See original GitHub issue

The sliders work well in a regular div, but if I place the div within an ng-repeat div, the onChange event is not triggered. I have localized the error, and I do not believe it is related to the $index variable. If I replace the loop with 5 copies of the tag, referencing the items from 0 to 4, it works fine.

<div ng-repeat="choice in choices track by $index"> <div style="{{'height:' + (choices.length*1.5) + 'em;'}}"> <rzslider rz-slider-model="alignment[$index].utility" rz-slider-options="{id:qid+'_'+$index,floor:min,ceil:max,vertical:true,showTicksValues:true,onChange:$parent.slideChange}" > </rzslider> </div> <div class="clearfix"></div> <div class="rubric" ng-bind-html="choices[$index].n|space2Break"></div> </div>

(I cannot figure out how to get newlines and tabs to be visible in this markup.)

EDIT: Actually, I was wrong about working if I made separate copies. It appears to be a problem referencing and indexed array of values for the model.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Hossam-Hazemcommented, Jul 21, 2016

having the same problem slider works fine outside ng-repeat, when ng-repeat is applied, slider breaks even when using static values in rz-slider.options

1reaction
swil85commented, Mar 27, 2019

A friend find a solution, by using an object for value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-change does not work with ng-repeat with options but ...
The ng-change event is triggered at every change in the value. Here is a working solution: jsfiddle <select ng-model="level1Selected" ...
Read more >
ng-repeat on ng-select with onChange function repeats the ...
You have a problem with the inheritance of the scope. you are reusing the same scope variable inside your nested (ngRepeat creates new...
Read more >
select - AngularJS: API
The select directive is used together with ngModel to provide data-binding between the scope and the <select> control (including setting default values). It ......
Read more >
On how find which function is getting called onchange of value ...
I am new to Service portal and Angularjs as well. I am unable to find which function is getting called on change of...
Read more >
How to Add Dynamic Options for Multiple Selects Inside ng ...
To add more select menus to the DOM, we only need to push an empty object to the model's array, the ng-repeat directive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found