Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* js controller */
- $scope.colors = {};
- $scope.color = {};
- $http.get(
- 'vehicle-colors'
- ).success(function(data){
- console.log(data);
- $scope.colors = data;
- });
- /* ********************** */
- $scope.colorsTableParams = new ngTableParams({
- page: 1, // show first page
- count: 10 // count per page
- }, {
- total: $scope.colors.length, // length of data
- getData: function($defer, params) {
- $http.get(
- 'vehicle-colors'
- ).success(function(data){
- $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
- });
- }
- });
- /* 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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement