【发布时间】: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> </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