Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. var lmApp = angular.module('lmApp', []);
  2.  
  3. lmApp.service('StudentService', function() {
  4. this.stuIndex = [
  5. {
  6. id: 1,
  7. grade: 9,
  8. profile: {
  9. firstName:'Adam',
  10. lastName: 'Smith'
  11. }
  12. },
  13. {
  14. id: 2,
  15. grade: 4,
  16. profile: {
  17. firstName:'Billie',
  18. lastName: 'Holiday'
  19. }
  20. },
  21. {
  22. id: 3,
  23. grade: 0,
  24. profile: {
  25. firstName:'Peter',
  26. lastName: 'Hootinanny'
  27. }
  28. },
  29. {
  30. id: 4,
  31. grade: 8,
  32. profile: {
  33. firstName:'Jimmy',
  34. lastName: 'Joejoe'
  35. }
  36. },
  37. {
  38. id: 5,
  39. grade: 1,
  40. profile: {
  41. firstName:'Sam',
  42. lastName: 'Samson'
  43. }
  44. },
  45. {
  46. id: 6,
  47. grade: 2,
  48. profile: {
  49. firstName:'Steve',
  50. lastName: 'Rider'
  51. }
  52. },
  53. {
  54. id: 7,
  55. grade: 9,
  56. profile: {
  57. firstName:'Wally',
  58. lastName: 'Wilkinson'
  59. }
  60. },
  61. {
  62. id: 8,
  63. grade: 9,
  64. profile: {
  65. firstName:'June',
  66. lastName: 'Jepster'
  67. }
  68. },
  69. {
  70. id: 9,
  71. grade: 9,
  72. profile: {
  73. firstName:'Amy',
  74. lastName: 'Cider'
  75. }
  76. },
  77. {
  78. id: 10,
  79. grade: 9,
  80. profile: {
  81. firstName:'Cindy',
  82. lastName: 'Sojourn'
  83. }
  84. }
  85. ];
  86.  
  87. return this.stuIndex;
  88.  
  89. });
  90.  
  91. ////////////////////////////////
  92. ////////// STEP TWO ////////////
  93. // BEGINS BUILDING CONTROLLER //
  94. ////////////////////////////////
  95.  
  96.  
  97. lmApp.controller('studentController', ['$scope', 'StudentService', function($scope, StudentService){
  98. $scope.studentList = StudentService;
  99.  
  100. $scope.predicate = 'id';
  101. $scope.reverse = false;
  102.  
  103. $scope.order = function(predicate) {
  104. $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
  105. $scope.predicate = predicate;
  106. };
  107.  
  108. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement