标签:
<tr ng-repeat="item in items"> <td>{{$index + 1}}</td> <td>{{item.name}}</td> <td>{{item.price | currency}}</td> <td><input ng-model="item.quantity"></td> <td>{{item.quantity * item.price | currency}}</td> <td> <button ng-click="remove($index) or ng-click="remove(item )">Remove</button> </td> </tr>
方法1、
$scope.remove = function (index) { $scope.items.splice(index, 1); }
方法2、
$scope.remove = function (index) { $scope.items.splice($scope.items.indexOf(index), 1); }
标签:
原文地址:http://my.oschina.net/u/2395167/blog/529963