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 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.
i am just guessing this ,<div ng-repeat="venue in venues" ng-mouseover="" class="venue"><div ng-controller="manageInfo" >the ng-controller is with in the repeat it is correct?try to change<div ng-controller="manageInfo" ><div ng-repeat="venue in venues" ng-mouseover="" class="venue">
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/3tvQsFvXYc8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.