Despite its apparent simplicity, this issue has consumed hours of my time.
Here is the code I'm working with:
<div class="row grid" id="draftRow{{$index}}" ng-repeat="draft in drafts">
<div class="col-md-7 cell" ng-bind="draft.getTitle()"></div>
<div class="col-md-2 cell center" ng-bind="draft.getUserName()"></div>
<div class="col-md-2 cell center" ng-bind="draft.getDate()"></div>
<div class="col-md-1 cell center" >
<span class="gridbutton" ng-click="editPost(draft.getPostID())">edit</span>
|
<span class="gridbutton" ng-click="deletePost(draft.getPostID(),'{{$index}}')">delete</span>
</div>
</div>
Although I can see
deletePost(draft.getPostID(),'0')
in the browser's inspect element, the deletePost function is not being called onclick. Can anyone point out what the issue might be? Interestingly, everything runs smoothly if I remove the second parameter from the deletePost function.
I have also experimented with using $parent.$index
, which successfully calls the function but does not display the rowIndex
in the inspect element.