Skip to content

Instantly share code, notes, and snippets.

@beckyconning
Forked from ekancepts/gist:62ef8662d843bcef0f09
Last active August 29, 2015 14:03
Show Gist options
  • Save beckyconning/a29417968f45f12e6a81 to your computer and use it in GitHub Desktop.
Save beckyconning/a29417968f45f12e6a81 to your computer and use it in GitHub Desktop.
/* js controller */
$scope.colorsTableParams = new ngTableParams({
page: 1,
count: 10
}, {
total: 0,
getData: function($defer, params) {
$http.get('vehicle-colors').success(function (data) {
$timeout(function () {
params.total(data.total);
$defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}, 250);
});
}
});
$scope.color = {};
/* view */
<div id="color-list">
<h2>Vehicle Colors</h2>
<p><strong>Page:</strong> {{colorstableParams.page()}}</p>
<p><strong>Count per page:</strong> {{colorstableParams.count()}}</p>
<table ng-table="colorsTableParams" class="uk-table uk-width-1-1 uk-text-center">
<tr ng-repeat="color in colors">
<!-- <td data-title="'ID'">{{color.id}}</td>-->
<td data-title="'Name'">{{color.caption}}</td>
<td data-title="'Manufacturer'">{{color.vmo_caption}}</td>
<!-- <td data-title="''">{{color.image}}</td>-->
</tr>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment