javascript - Angular 数据表 ng-repeat 不起作用

标签 javascript angularjs datatables angularjs-ng-repeat angular-datatables

我正在使用angular-datatables但是当我使用 ng-repeat 时,数据表的功能不起作用(排序、搜索、计数等)

HTML:

<table  datatable=""  class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
    <tr>
        <th><input type="checkbox" id="checkall" /></th>
        <th>Navn</th>
        <th>Projekt</th>
        <th>Timer</th>
        <th>Uge</th>
        <th>Edit</th>
    </tr>
    </thead>

    <tbody ng-repeat="timesheet in timesheets">
    <tr>
        <td><input type="checkbox" class="checkthis" /></td>
        <td>{{timesheet.user}}</td>
        <td>{{timesheet.projectid}}</td>
        <td>  <standard-time-no-meridian etime='timesheet.TotalTime'></standard-time-no-meridian></td>
        <td>{{timesheet.week}}</td>
        <td><p data-placement="top" data-toggle="tooltip" title="Edit"><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" ><span class="glyphicon glyphicon-pencil"></span></button></p></td>
    </tr>
    </tbody>

 </table>

JavaScript:

  .controller('TimesheetMainCtrl', function ($rootScope, $scope, $timeout) {

   dpd.timesheetold.get(function (result, err) {

        if (err) return console.log(err);
       $timeout(function() {
           $scope.timesheets = result;


       })
    })

});

我尝试将 ng 添加到 datatable=""但这只会给我一个控制台错误

TypeError: Cannot read property 'serverSide' of undefined at Object.f [as fromOptions] (angular-datatables.min.js:6)

最佳答案

接缝是 Angular 数据表中的错误 https://github.com/l-lin/angular-datatables/issues/439

将在 0.51 中修复,直到它可以运行旧版本

关于javascript - Angular 数据表 ng-repeat 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33289592/

相关文章:

angularjs - 您如何使用 ui-router 保护/处理经过身份验证的路由?

jquery - 滚动到数据表中的特定行

Jquery UI 破坏了网站上的所有其他表

javascript - 找不到状态变量

javascript - 有没有办法查看元素是否可见、可点击?

css - 在angularjs中实现模态内的过渡效果

java - 数据表 - 在数据表中加载 JSON 响应

javascript - 视频响应不起作用

javascript - 如何从 Javascript 导航到使用复杂类型作为 Javascript 参数的 MVC5 Controller

javascript - Angular : Update service and share data between controllers