2016-04-25 61 views
0

嗨我正在Angularjs Datatables和嘗試使用ng-repeat迭代列和行,但它不工作。我檢查了文檔,但無法找到在html上傳遞列和記錄的確切方式。AngularJs Datatables無法迭代html上的列使用ng重複

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"> 


感謝,

+0

您在哪裏使用過ng-repeat?你在哪裏分配數據到範圍? –

+0

@KishoreBarik像 <表數據表= 「」 類= 「行邊界懸停」> HTML {{柱}} ​​{{record.name}}​​{{record.date}} 和上控制器$ scope.columns = resoponse.data; $ scope.records = response.data; –

回答

0

如果你想使用角度的方式來結合日期 您的表必須是這樣的

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

docs.

+0

歡迎來到SO!在向人們的問題發佈解決方案時,必須在所有包含的鏈接中包含所有信息 – MayorMonty

+0

@MayorMonty您的所有信息是什麼意思? –