Skip to content

Problem with onChange in ng-repeat #255

@queejie

Description

@queejie

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions