首页 > 其他 > 详细

$index

时间:2015-11-13 15:58:21      阅读:298      评论:0      收藏:0      [点我收藏+]
<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);
        }


$index

原文:http://my.oschina.net/u/2395167/blog/529963

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!