Advertisement
mogaj

Untitled

Jul 10th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. /* js controller */
  2. $scope.colors = {};
  3. $scope.color = {};
  4. $http.get(
  5. 'vehicle-colors'
  6. ).success(function(data){
  7. console.log(data);
  8. $scope.colors = data;
  9. });
  10. /* ********************** */
  11. $scope.colorsTableParams = new ngTableParams({
  12. page: 1, // show first page
  13. count: 10 // count per page
  14. }, {
  15. total: $scope.colors.length, // length of data
  16. getData: function($defer, params) {
  17. $http.get(
  18. 'vehicle-colors'
  19. ).success(function(data){
  20. $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
  21. });
  22. }
  23. });
  24.  
  25. /* View */
  26.  
  27. <div id="color-list">
  28. <h2>Vehicle Colors</h2>
  29.  
  30. <p><strong>Page:</strong> {{colorstableParams.page()}}</p>
  31. <p><strong>Count per page:</strong> {{colorstableParams.count()}}</p>
  32. <table ng-table="colorsTableParams" class="uk-table uk-width-1-1 uk-text-center">
  33. <tr ng-repeat="color in colors">
  34. <!-- <td data-title="'ID'">{{color.id}}</td>-->
  35. <td data-title="'Name'">{{color.caption}}</td>
  36. <td data-title="'Manufacturer'">{{color.vmo_caption}}</td>
  37. <!-- <td data-title="''">{{color.image}}</td>-->
  38. </tr>
  39. </table>
  40. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement