AngularJs Datatables无法使用ng-repeat迭代html上的列

时间:2016-04-25 05:32:01

标签: javascript angularjs angular-datatables

您好我正在使用Angularjs Datatables并尝试使用ng-repeat迭代列和行,但它不起作用。我检查了文档,但无法找到在html上传递列和记录的确切方法。

                                                             
function CustomElementCtrl(DTOptionsBuilder, DTColumnBuilder) {  
    var vm = this;  
    vm.dtOptions = DTOptionsBuilder.fromSource('data.json')  
        .withDOM('<"custom-element">pitrfl');  
    vm.dtColumns = [  
        DTColumnBuilder.newColumn('id').withTitle('ID'),  
        DTColumnBuilder.newColumn('firstName').withTitle('First name'),
        DTColumnBuilder.newColumn('lastName').withTitle('Last name').notVisible()
    ];
}
Here the dtColumns are manually created and the dtOptions are directly assigned from json, but I want to assign columns also from json.
And why I can't use ng-repeat on html to iterate both columns and rows
rather then like this <table datatable="" dt-options="showCase.dtOptions"   dt-columns="showCase.dtColumns" class="row-border hover">


谢谢,

1 个答案:

答案 0 :(得分:0)

如果要使用Angular方式绑定日期 你的桌子必须像这样

<table datatable="ng" class="row-border hover"></table>

根据docs.