Question

In the code below,i am having a variable in controller named "selectedDesignAreaId" and i bind this variable with the current value of "designarea.id",but when i change "selectedDesignAreaId" to any of the value of designAreaId in repeater the class is not updated...Always 'unSelectedCanvas' is setted...

<div ng-repeat="designArea in productView.designAreas" style="position:absolute;left:{{designArea.x}}px ; top:{{designArea.y}}px;background-color: #ffdead"
                 ng-click="onDesignAreaClick(designArea.id)"
                 ng-class="{true: 'selectedCanvas', false:'unSelectedCanvas'}[(designArea.id == selectedDesignAreaId)]">
Was it helpful?

Solution

I tried to reproduce your issue, but it seems to be working for me: http://plnkr.co/edit/AuACV3SZRPgEqGBWpvkl

I hope you can identify the cause using this code.

You may want to make sure contents of selectedDesignAreaId and designArea.id and such. just putting {{ selectedDesignAreaId }} into your template would ease your debugging process. (IMO, it is even handier than using dev console.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top