When creating a table with AngularJS, I utilized the orderBy
filter. However, after implementing this filter, my delete function started removing rows unexpectedly without me clicking to delete.
Below is the code for the filter:
<tr class = "table-row isActive-{{task.active}} rowNumber-{{$index + 1}}" ng-repeat = "task in tasks | filter:search:strict | orderBy: '-priority':true">
<td>
<span class="delete-link">
<input type="button" data-ng-click="removeRow($index)"/>
</span>
</td>
</tr>
And here is the delete function:
$scope.removeRow = function (productIndex) {
$scope.tasks.splice(productIndex, 1);
productIndex=0
};
It seems there may be an issue with my setup. What am I missing?