【发布时间】:2014-03-10 16:00:42
【问题描述】:
我的html:
<table data-table ng-show="bookings">
<thead>
<tr>
<th>Name</th>
<th>Surname</th>
<th>ID number</th>
<th>Email</th>
<th>Cellphone</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="booking in bookings | orderBy:['student.firstname', 'student.surname']">
<td>{{ booking.student.firstname }}</td>
<td>{{ booking.student.surname }}</td>
<td>{{ booking.student.id_number }}</td>
<td>{{ booking.student.email }}</td>
<td>{{ booking.student.cellphone }}</td>
</tr>
</tbody>
</table>
我的指令:
.directive('dataTable', function() {
return {
restrict: 'A',
replace: false,
transclude: true,
link: function (scope, el, attrs) {
console.info('dataTable', el);
$(el).dataTable();
}
}
})
我没有收到任何错误,但没有显示任何内容(我现在不知道el 是什么)。我希望在信息被嵌入的地方使用它,然后使用 dataTable 的“零配置”。我认为这很简单,唉,指令:(
【问题讨论】:
-
顺便说一句,你检查过angular-table吗?
-
@Atropo 谢谢你,虽然我必须有过滤框和分页
标签: javascript angularjs jquery-datatables