Angularjs table 问题中没有可用数据

Angularjs no data available in table issue

我正在使用 angularjs 数据 table,每次在呈现 table 之前我都会收到 "no data available in table" 消息。在 table 消息后显示预期的数据 way.so 如何解决这个问题? 检查 demo

    app.controller('myCtrl', function($scope,$http,DTOptionsBuilder, DTColumnBuilder,DTColumnDefBuilder) {

            $scope.service = service;
            $http.get('ajax/list.php').success(function(data){
            $scope.cus_list = data;      


            $scope.vm = {};


            $scope.vm.dtOptions = DTOptionsBuilder.newOptions()
            .withOption('order', [0, 'asc']);
            $scope.vm.dtColumnDefs = [
                                          DTColumnDefBuilder.newColumnDef(1).notSortable()
                                      ];


    });
});

table 在数据从服务器返回之前呈现。您可能希望在 HTML 元素之一上使用 ng-if 以等待数据可用:

<table ng-if="userList" datatable="ng">

编辑 您不喜欢的消息的 CSS class 为 dataTables_empty。因此,如果数据都已加载并且 table.

中没有显示任何行,那么也许您只能用 CSS 显示它

这对我有用,table 在数据从服务器返回之前呈现。您可能想使用

<table class="table table-bordered" *ngIf="mynotes" datatable [dtOptions]="dtOptions">