我是AngularJS中的新成員。我面臨一個問題,我的數據沒有顯示在數據表中。誰能幫我這個?AngularJS datables
我的代碼
HTML代碼
<div class="content table-responsive table-full-width">
<table id="myTable" class="table table-striped table-hover" datatable="">
<thead>
<th>Account ID</th>
<th>Name</th>
<th>Email</th>
<th>Registered On</th>
<!--<th>Settings</th>-->
<th>Status</th>
</thead>
<tbody>
<tr ng-repeat="user in users">
<td style="text-align:left;">{{user.account}}</td>
<td style="text-align:left;">{{user.name}}</td>
<td style="text-align:left;">{{user.email}}</td>
<td style="text-align:left;" ng-model="dateVal">{{user.register}}</td>
<td style="text-align:left;">
<span class="label {{ user.status == 1 && 'label-success' || 'label-danger'}} " ng-click="updated(user.id)">
{{ user.status == 1 && 'Active' || 'Inactive'}}
</span>
</td>
<td>
<a href="index.html#/edit_userpermission?id={{user.id}}" class="fa fa-cog" data-toggle="modal" data-target="#myModal"></a>
</td>
</tr>
</tbody>
</table>
JS代碼
/* User Listing */
var url = UserService.url+'users.php?token='+localStorage.getItem("token");
$http.get(url).success(function(data)
{
$('#myTable').DataTable();
if(data.login != null){
$location.path("/logout");
}
$scope.users = data;
});
當我點擊排序選項時,它會顯示「表中沒有可用數據」... 爲什麼會發生這種情況? 等待迴應。在此先感謝
使用過濾器進行排序目的 – etee
我提到的網站「https://datatables.net/」。我在DataTables CDN上提供了兩個文件: –
您可以提供一個可以運行的plunker嗎? – etee