0
我使用AngularJS表。我用orderBy
過濾器。之後,我的刪除功能開始刪除另一行,除了我點擊刪除。錯誤的行刪除與orderBy過濾器angularjs
這裏是過濾器:
<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>
和刪除功能:
$scope.removeRow = function (productIndex) {
$scope.tasks.splice(productIndex, 1);
productIndex=0
};
我錯過了什麼?
你必須在'removeRow'功能使用相同的順序。在ng-repeat中應用的過濾順序不會對數組本身進行排序。 –