国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

angular動態刪除ng-repaeat添加的dom節點的方法

2019-11-19 16:01:58
字體:
來源:轉載
供稿:網友

本文介紹了angular動態刪除ng-repaeat添加的dom節點的方法,分享給大家供大家參考,具體如下:

通過點擊刪除按鈕刪除數據庫信息以及當前行

html代碼如下:

<div class="row">  <div class="col-xs-12">    <!-- PAGE CONTENT BEGINS -->    <div class="row">      <div class="col-xs-12">        <table id="simple-table" class="table table-bordered table-hover">          <thead>          <tr>            <th>姓名</th>            <th>學歷</th>            <th class="hidden-480">專業</th>            <th>              <i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>              工作時間            </th>            <th class="hidden-480">工作經歷</th>            <th></th>          </tr>          </thead>          <tbody>          <tr ng-repeat="x in jl" class="hang">//通過ng-repeat迭代創建dom            <td>              <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >{{x.name}}</a>            </td>            <td>{{x.education}}</td>            <td class="hidden-480">{{x.major}}</td>            <td>{{x.workYear+'年'}}</td>            <td class="hidden-480">              {{x.workExperience}}            </td>            <td>              <div class="hidden-sm hidden-xs btn-group">                <button class="btn btn-xs btn-success">                  <i class="ace-icon fa fa-check bigger-120"></i>                </button>                <button class="btn btn-xs btn-info">                  <i class="ace-icon fa fa-pencil bigger-120"></i>                </button>                <button class="btn btn-xs btn-danger" ng-click="_delete($index)">                  <i class="ace-icon fa fa-trash-o bigger-120"></i>                </button>                <button class="btn btn-xs btn-warning">                  <i class="ace-icon fa fa-flag bigger-120"></i>                </button>              </div>              <div class="hidden-md hidden-lg">                <div class="inline pos-rel">                  <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto">                    <i class="ace-icon fa fa-cog icon-only bigger-110"></i>                  </button>                  <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">                    <li>                      <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip-info" data-rel="tooltip" title="View">                                      <span class="blue">                                        <i class="ace-icon fa fa-search-plus bigger-120"></i>                                      </span>                      </a>                    </li>                    <li>                      <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip-success" data-rel="tooltip" title="Edit">                                      <span class="green">                                        <i class="ace-icon fa fa-pencil-square-o bigger-120"></i>                                      </span>                      </a>                    </li>                    <li>                      <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip-error" data-rel="tooltip" title="Delete">                                      <span class="red">                                        <i class="ace-icon fa fa-trash-o bigger-120"></i>                                      </span>                      </a>                    </li>                  </ul>                </div>              </div>            </td>          </tr>          </tbody>        </table>      </div><!-- /.span -->    </div><!-- /.row -->    <!-- PAGE CONTENT ENDS -->  </div><!-- /.col --></div><!-- /.row -->

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);//截取數組,刪除當前行    });  }});

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 明星| 信阳市| 岐山县| 盱眙县| 英吉沙县| 无极县| 扬中市| 淮南市| 台中县| 德化县| 苏尼特右旗| 阿拉善右旗| 大名县| 东明县| 西充县| 安义县| 商丘市| 五莲县| 汨罗市| 察哈| 韶关市| 民县| 余干县| 军事| 海兴县| 喀什市| 祁阳县| 清涧县| 三亚市| 鸡西市| 曲阜市| 随州市| 冕宁县| 神池县| 新巴尔虎右旗| 沽源县| 宁强县| 海盐县| 扶绥县| 共和县| 海林市|