Here is the code
<tr ng-repeat="collection in collections | orderBy:'-modifiedDate' track by $index" ng-init="listIndex = $index">
If I remove orderBy:'-modifiedDate'
, the deletion on a specific element is working great. However, I need the collection/array to be rendered in sorted way that's why I have orderBy.
If I don't delete the orderBy:'-modifiedDate'
from the code and I delete a random element say on position 7, the element that gets deleted is the very last always.
I had to use ng-init
since I have another ng-repeat
inside the ng-repeat
shown above. I call the delete function like this, ng-click="deleteRow(listIndex)"
deleteRow
code as well? – Wage