本篇文章主要介绍了angular动态删除ng-repaeat添加的dom节点的方法,非常具有实用价值,需要的朋友可以参考下
本文介绍了angular动态删除ng-repaeat添加的dom节点的方法,分享给大家供大家参考,具体如下:
通过点击删除按钮删除数据库信息以及当前行
万博manbetx平台代码如下:
姓名 学历 专业 工作时间 工作经历 //通过ng-repeat迭代创建dom {{x.name}} {{x.education}} {{x.major}} {{x.workYear+'年'}} {{x.workExperience}}
js代码如下:
angular.controller('tables',function ($scope,$http) { $http({ method: 'GET', url:'resumes/myResume/'+USER.id }).then(function success(rep) { $scope.jl=rep.data; }); $scope._delete=function (idx) { $scope.id=$scope.jl[idx].id; $http({ method:'DELETE', url:'resumes/'+$scope.id }).then(function success(rep) { $scope.jl.splice(idx, 1);//截取数组,删除当前行 }); } });
以上就是angular动态删除ng-repaeat添加的dom节点的方法的详细内容,更多请关注万博manbetx平台中文网其它相关文章!