Is there a way to use ng-repeat and DataTables?
Is there a way to use ng-repeat and DataTables?
brunolopesr
Posts: 1Questions: 1Answers: 0
I am using AngularJS in work, and I tried to build a datatable this way:
In the AngularJS controller:
$scope.thing = {
"data": [
[
"Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011/04/25",
"$320,800"
],
}
In the HTML file:
<table datatable-basic class="table table-striped table-bordered table-hover" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in thing.data">
<td ng-repeat="value in row">{{value}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
datatable-basic is a custom attribute key that calls a directive, calling the element.DataTable();
And the result is this:
http://i.imgur.com/iU6YvaY.png
The data appears, but if I try to change the page, the data is erased.
Please, help me...
This discussion has been closed.