<a id="{{item.pt_id}}" href="#" ng-click="doDelete($event.target)">删除</a>
$scope.doDelete = function(target){
$scope.filterKeys.pt_id = $( target ).attr("id");
if($scope.filterKeys.pt_id!=undefined){
if(confirm("确定删除该信息?")){
$http.get(con.host + "delete", {params: $scope.filterKeys}).success(function (data) {
// alert(JSON.stringify(data));
$scope.doQuery();
})
}
}
}
本文介绍了一种在AngularJS应用中实现删除功能的方法。通过使用$scope.doDelete函数,结合HTML中的点击事件,可以轻松地从数据库中移除指定的数据项。在确认用户确实想要删除之后,应用程序会发送HTTP GET请求到后端API,执行实际的删除操作。
480

被折叠的 条评论
为什么被折叠?



