【问题标题】:angularjs datatables TypeError: this.renderDataTableAndEmitEvent is not a functionangularjs 数据表类型错误:this.renderDataTableAndEmitEvent 不是函数
【发布时间】:2016-06-02 13:32:55
【问题描述】:

您好,我是 angularjs 新手,在使用从 http://l-lin.github.io/angular-datatables/#/zeroConfig 下载的 Angularjs 数据表时遇到问题,出现 TypeError: this.renderDataTableAndEmitEvent is not a function 我已经安排好了脚本以正确的顺序排列,但即使在它之后也会出现同样的问题。

我的 angularjs 代码是

var myApp = angular.module('myApp', ['datatables']);
myApp.controller('AppCtrl', ['$scope', '$http', function($scope, $http) {
    $http.get('/contactlist').success(function(response){
        console.log(response);
        $scope.contactlist = response;
    });
}]);

以下是我的 HTML 代码

<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myApp">
<script src="datatable/jquery.min.js"></script>
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/angular.min.js"></script>
<script src="datatable/angular-datatables.min.js"></script>
<link rel="stylesheet" href="datatable/datatables.min.css">
<script src="controllers/contactlistcontroller.js"></script>
<div class="container" ng-controller="AppCtrl">
<h1>Contact List App</h1>

<table width="100%" border="1" cellspacing="1" cellpadding="2" class="table" datatable="">
<thead>
  <tr>
    <td>Name</td>
    <td>Email</td>
    <td>Number</td>
    <td>Action</td>
    <td>&nbsp;</td>
  </tr>
  </thead>
   <tbody>
   <tr ng-repeat="contact in contactlist">
   <td>{{ contact.name}}</td>
   <td>{{ contact.email}}</td>
   <td>{{ contact.number}}</td>
   <td><button ng-click="remove(contact._id)" class="btn-danger">Remove</button></td>
   <td><button ng-click="edit(contact._id)" class="btn-warning">Edit</button></td>
   </tr>
   </tbody>
</table>
</div>
</html>

我能够在表格中打印我的数据,但数据表不适用,提前致谢。

【问题讨论】:

    标签: angularjs datatables angular-datatables


    【解决方案1】:

    由于“angular-datatables.min.js”而出现此错误,请将其替换为新错误,您的错误将得到解决。

    【讨论】:

      猜你喜欢
      • 2016-09-06
      • 1970-01-01
      • 2016-02-26
      • 2013-04-01
      • 2016-03-06
      • 2020-04-17
      • 2018-04-28
      • 2019-02-14
      相关资源
      最近更新 更多