<万博manbetx平台>angular动态删除ng-repaeat添加的dom节点的方法 - 万博manbetx平台中文网

angular动态删除ng-repaeat添加的dom节点的方法

本篇文章主要介绍了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平台中文网其它相关文章!

赞(0) 打赏
未经允许不得转载:万博manbetx平台中文网首页 » Angular.js 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏