angulars函数

$index

拿到当前的id,在np-repeat中使用可以拿到数组中本条数据的内置id,

可以用来进行动态删除列表的操作。

   <tbody>
    <tr ng-repeat="x in attrlist">
        <td><input type="checkbox" class="icheckbox_square-blue"></td>
        <td><input class="form-control" placeholder="属性名称"></td>
        <td>
            <button type="button" class="btn btn-default" title="删除"
                    ng-click="attr_del($index)"><i class="fa fa-trash-o"></i> 删除
            </button>
        </td>
    </tr>
    </tbody>

数组的splice方法

删除数组中的元素,第一参数是index(索引),第二个是删除的个数

//新增拓展属性的删除
	$scope.attr_del=function (index) {
		$scope.attrlist.splice(index,1)
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值