Javascript ng单击不处理datatable ajax数据

Javascript ng单击不处理datatable ajax数据,javascript,jquery,angularjs,ajax,datatables,Javascript,Jquery,Angularjs,Ajax,Datatables,我使用datatable jquery生成表,并在datatable中使用AJAX 我的表格生成成功,但其中一列有ng click功能,当我点击它不工作时,我的意思是它不会进入控制器 输出为: 这是我的密码: 控制器: 'use strict'; app.controller('AdminController', ['$scope', '$http', '$state','sessionService', function($scope, $http, $state, sessionServi

我使用datatable jquery生成表,并在datatable中使用AJAX

我的表格生成成功,但其中一列有ng click功能,当我点击它不工作时,我的意思是它不会进入控制器

输出为: 这是我的密码:

控制器:

'use strict';

app.controller('AdminController', ['$scope', '$http', '$state','sessionService', function($scope, $http, $state, sessionService) {
    $scope.authError = null;
    $scope.loading = false ; 
    $scope.tbOptions = {
        data: [],
        sAjaxSource: 'api/api.php?type=admin_users',
        aoColumns: [
            { mData: 'no' },
            { mData: 'name' },
            { mData: 'email' },
            { mData: 'role' },
            { mData: 'action' }
        ],
        aoColumnDefs: [
            {
                aTargets: [4],
                mRender: function (data, type, full) {
                    var tbAction = '';
                    tbAction += '<button type="button" ng-click="editAdmin('+full.id+')" class="btn btn-xs btn-default"><i class="fa fa-pencil"></i></button>';
                    tbAction += '&nbsp&nbsp;&nbsp;';
                    tbAction += '<button type="button" ng-click="deleteAdmin('+full.id+')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i></button>';
                    return tbAction;
                }  
            }
        ]
    };
    $scope.editAdmin = function(id){
        console.log('S-'+id);
    }

    $scope.deleteAdmin = function(id){
        console.log('S-'+id);
    }
}]);
任何帮助都将不胜感激


谢谢

您能否提供plunkerplunker not Working当您有这样动态插入的HTML时,您需要手动使用
$compile
服务将
ng单击链接到特定范围。如果你让一个正在填充表格的plunker工作,我可以给你展示一个例子。Plunkr不工作,我也有同样的问题。我试图操纵plunkr使其工作,但似乎也无法运行。有人可以发布一个有效的plunkr吗?你可以提供PlunkerPlunkr not working吗?当你有这样动态插入的HTML时,你需要手动使用
$compile
服务将
ng点击链接到特定的范围。如果你让一个正在填充表格的plunker工作,我可以给你展示一个例子。Plunkr不工作,我也有同样的问题。我试图操纵plunkr使其工作,但似乎也无法运行。有人可以发布一个工作日志吗?
<div class="bg-light lter b-b wrapper-md">
  <h1 class="m-n font-thin h3">Admin User List</h1>
</div>
<div class="wrapper-md">
  <div class="panel panel-default">
    <div class="panel-heading">
      Admin User
    </div>
    <div class="table-responsive">
      <table ui-jq="dataTable" ui-options="tbOptions" class="table table-striped b-t b-b" ng-controller="AdminController" ajax-datatable>
        <thead>
          <tr>
            <th  style="width:20%">No.</th>
            <th  style="width:25%">Name</th>
            <th  style="width:25%">Email</th>
            <th  style="width:15%">Role</th>
            <th  style="width:15%">Action</th>
          </tr>
        </thead>
        <tbody>
        </tbody>
      </table>
    </div>
  </div>
</div>
'use strict';

angular.module('app')
  .directive('ajaxDatatable', function ($compile) {
  return {
    restrict: 'A',
    replace: true,
    link: function (scope, ele, attrs) {
      scope.$watch(attrs.dynamic, function(html) {
        ele.html(html);
        $compile(ele.contents())(scope);
      });
    }
  };
});