I'm trying to implement a shortlisting functionality in a case where I'm using ng-click inside ng-repeat.
While the $index is being displayed correctly outside the ng-click, $index is only the index of the last object in the JSON array in all the cases where the html is generated using ng-repeat. I was expecting the respective venue or venue.id to be passed as an argument to shortlistThis(). I'm guessing that this could be an issue related to event binding. Can someone help me understand what's going wrong here and probably a better way to do this if possible. I did try checking this Bind ng-model name and ng-click inside ng-repeat in angularjs <http://stackoverflow.com/questions/21385164/bind-ng-model-name-and-ng-click-inside-ng-repeat-in-angularjs> The fiddle here works just fine but, mine doesn't. Here's a fiddle that you can look into. Just zoom out a bit, click on any name on the left pane and then, hit the shortlist button to see an alert. The alert value is 7 in all the cases. http://jsfiddle.net/yashwanthm/mos9rvvs/ -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
