<div ng-repeat="post in vm.post track by $index">
<button ng-click="vm.remove(post,$index)"></button>
<div ng-repeat="comment in post.cmt track by comment._id">
<div ng-repeat="reply in comment track by reply._id">
<button ng-click="vm.remove(post,'what shoud I pass here as index')"></button>
</div>
</div>
</div>
vm.remove = function() {
if (isConfirm) {
groupFactory.updateGroupMember(data).then(function(response) {
SweetAlert.swal('Deleted!', response.data.message);
vm.post.splice(index, 1);
}, function(error) {
$scope.showError(error.data.message);
});
}
}
如何在回复的最后一次内部ng重复中获取当前索引,就像在vm中一样。post的删除()