数据表在angular.js中不起作用

时间:2016-02-16 12:37:06

标签: javascript jquery angularjs datatables

我试图在我的表格中应用dataTabe,但我没有得到正确的数据表。

我首先在角度表中填充我应用dataTable的数据,而没有dataTable我得到了正确的结果;

我的控制器:

 MyService.getData(function (response) {
    if (response.data.success) {
        $scope.items = angular.copy(response.data);
            $timeout(function () {
                var table = $("#test").dataTable();
            }, 200)

    } else {
        $scope.items = [];
    }
});

HTML:

<table id="test">
    <thead>
        <tr>
            <th style="width: 10%">Id</th>
            <th style="width: 20%">Group Name</th>
            <th style="width: 20%">Created Date</th>
            <th style="width: 20%">Updated Date</th>
        </tr>
    </thead>

    <tbody ng-repeat="item in items">
        <tr>
            <td>{{item.userGroupId}}</td>
            <td>{{item.groupName}}</td>
            <td>{{item.createdDate}}</td>
            <td>{{item.updatedDate}}</td>
        </tr>
    </tbody>
</table>

screenShots:

  

在应用DataTable之前:

enter image description here

  

应用dataTable之后:

enter image description here

我在dataTable doc和google中搜索了但是我没有发现任何线索。请帮助我。

0 个答案:

没有答案