I'm using ng-repeat in the template for a custom directive as follows:
<li ng-repeat="image in images"> <img ng-src="{{image.url}}" ng-click="togglePhoto({{$index}})"> </li> When rendered on the page the source looks like
<li ng-repeat="image in images" class="ng-scope"> <img ng-src="http://example.com/example.jpg" ng-click="togglePhoto(1)" src="http://example.com/example.jpg"> </li> I have the function togglePhoto defined in my directive. Without the {{index}} parameter being passed in it works and the function is called. With the index, it doesn't fire.
How do I get the index of the photo clicked into the togglePhoto function?
togglePhoto(x)defined?