Problem with onChange in ng-repeat
See original GitHub issueThe 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:
- Created 8 years ago
- Comments:10 (4 by maintainers)

Top Related StackOverflow Question
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
A friend find a solution, by using an object for value.