0
我有一個表100行,如果我進入一個新的排它增加了它,並在表的頂部顯示爲降序按日期濾波器階與AngularJs
<table class="table">
<tr ng-repeat=" item in itemlist | orderBy:createdat:true">
<td>//code goes here</td>
<td><button ng-click="del(item)" class="fa fa-trash"></button></td>
</tr>
</table>
我有一個所有CRUD操作刪除按鈕,但問題是,當我刪除任何特定的行時,它只刪除該特定行,但仍顯示該行存在於表中,直到頁面被刷新。因此,任何想法..這將是對我很大的幫助.... 下面是代碼....只是在JS文件中的代碼複製plunker
在HTML
<div ng-app>
<div ng-controller="FooController">
<table>
<tr ng-repeat="item in items | orderBy:'num':true">
<td>{{item.num}} :: {{item.desc}}</td>
<td><button class="fa fa-trash" ng-click="del($index)">
delete
</button></td>
</tr>
</table>
</div>
function FooController($scope) {
$scope.items = [
{desc: 'a', num: 1},
{desc: 'b', num: 2},
{desc: 'c', num: 3},
];
$scope.del=function(idx){
$scope.items.splice(idx,1)
}
}
你可以創建plunker嗎? –
太寬泛。也許創建一個演示。 – dfsq
因此,您的代碼中存在一個錯誤,並希望找到並修復該錯誤。我們怎麼能沒有看到你的代碼呢? –