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

AngularJs Datatables not able to iterate columns on html using ng-repeat

本文关键字:html 迭代 ng-repeat Datatables AngularJs      更新时间:2023-09-26

嗨,我正在研究 Angularjs 数据表并尝试使用 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">


谢谢

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

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

根据文档。