I'm trying to use the ng-table
directive. Having a really hard time just getting the demo code to work properly in my local project.
http://ng-table.com
In my controller, I set up my data.
var dataset = [
{name: "Moroni50", age: 50},
{name: "Moroni49", age: 49},
{name: "Moroni48", age: 48},
{name: "Moroni47", age: 47},
{name: "Moroni46", age: 46},
];
$scope.tableParams = new NgTableParams({}, {dataset: dataset});
When I console.log($scope.tableParams)
it seems the object has been created successfully. However the it shows data
is an empty array with 0 length.
The render code then just shows the table header with no data.
<table ng-table="tableParams" class="table" show-filter="true">
<tr ng-repeat="user in $data">
<td title="'Name'" sortable="'name'">{{ user.name }}</td>
<td title="'Age'" sortable="'age'">{{ user.age }}</td>
</tr>
</table>
No idea what's going on, is there something simple I'm missing?