我正在使用jQuery和Angular Datatables。我没有在表格中获取数据。
TypeError:无法读取属性'匹配'在Object.i上的undefined [作为渲染](angular-datatables.min.js:6)
这些是我安排的插件。
<script type="text/javascript" src="js/jquery/1.11.1/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/angular-datatables.min.js"></script>
这是我在jsp文件中的表:保存在数据库中的所有实习都必须在表中查看。 jquery表是否适合与angularjs一起使用?
<table datatable="ng" dt-options="dtOptions" cellspacing="0" width="100%">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Category</th>
<th>Status</th>
<th>Created date</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Id</th>
<th>Title</th>
<th>Category</th>
<th>Status</th>
<th>Created date</th>
<th>Action</th>
</tr>
</tfoot>
<tbody ng-repeat="internship in deatilInternships[0]">
<tr>
<td><span>{{$index+1}}</span></td>
<td><span>{{internship.title}}</span></td>
<td><span>{{internship.category.name}}</span></td>
<td><span>{{internship.status}}</span></td>
<td><span>{{internship.appliedDate |
date:'d MMMM yyyy'}}</span>
</td>
<td>
<button class="btn btn-default btn-sm" data-title="Hold" data-toggle="modal" ng-click="hold(internship.id)"> <i class="fa fa-pause"></i>
</button> <a href="javascript:;" class="btn btn-default btn-sm" data-title="Edit" data-toggle="modal" ng-click="update(internship.id)">
<i class="icon bb-edit"></i></a>
<button class="btn btn-default btn-sm" data-title="Delete" data-toggle="modal" ng-click="deleteinternship(internship.id)"> <i class="icon bb-trash"></i>
</button>
<button class="btn btn-default btn-sm" data-title="View" data-toggle="modal" ng-click="viewInternship(internship.id)"> <i class="icon bb-view"></i>
</button>
</td>
</tr>
</tbody>
</table>
并且数据将在后端发布。
controller.js:
$scope.dtOptions = DTOptionsBuilder.newOptions().withPaginationType('full_numbers').withDisplayLength(10);
var getInternships = function () {
var data = "pageNumber=" + pageNumber + "&pageSize=" + $scope.pageSize;
internshipService.getInternships(data, function (data) {
if (data) {
$scope.internshipsLength = data.length;
}
if (data && data.length > 0) {
if (latestinterships.length == 0) {
latestinterships = data;
} else if (latestinterships.length > 0) {
latestinterships = latestinterships.concat(data);
}
$scope.deatilInternships = [];
var index = 0;
for (var i = 0; i < latestinterships.length; i++) {
if (!$scope.deatilInternships[index]) {
$scope.deatilInternships[index] = [];
}
$scope.deatilInternships[index].push(latestinterships[i]);
}
}
$rootScope.InternshipCount = data.length;
});
};
getInternships();
app.js:我也将依赖注入&#39;数据表&#39;
表中没有显示任何内容。