Browse Source

users pagination improvement

develop
Robin Thoni 9 years ago
parent
commit
9f46dcdcbc
2 changed files with 4 additions and 9 deletions
  1. 3
    8
      luticate/controllers/users.controller.js
  2. 1
    1
      luticate/views/users.html

+ 3
- 8
luticate/controllers/users.controller.js View File

11
                 groups: ['userList']
11
                 groups: ['userList']
12
             };
12
             };
13
 
13
 
14
-            $scope.loadUsers = function()
14
+            $scope.loadPage = function(page)
15
             {
15
             {
16
                 luticateAuthUsers.getAll({page: $scope.page, perPage: $scope.perPage}, promiseUsers)
16
                 luticateAuthUsers.getAll({page: $scope.page, perPage: $scope.perPage}, promiseUsers)
17
                     .then(function(users)
17
                     .then(function(users)
18
                     {
18
                     {
19
+                        $scope.page = page;
19
                         $scope.users = users;
20
                         $scope.users = users;
20
                         $scope.pages = [];
21
                         $scope.pages = [];
21
                         var start = Math.max(0, $scope.page - 5);
22
                         var start = Math.max(0, $scope.page - 5);
28
                     });
29
                     });
29
             };
30
             };
30
 
31
 
31
-            $scope.goToPage = function(page)
32
-            {
33
-                $scope.page = page;
34
-                $scope.loadUsers();
35
-            };
36
-
37
-            $scope.loadUsers();
32
+            $scope.loadPage($scope.page);
38
     }]);
33
     }]);

+ 1
- 1
luticate/views/users.html View File

23
         </table>
23
         </table>
24
 
24
 
25
         <div class="col-sm-12 text-center">
25
         <div class="col-sm-12 text-center">
26
-            <a class="{{ p == page ? 'pagination-current' : 'pagination-not-current'}}" href="" ng-repeat="p in pages" ng-click="goToPage(p)">{{ p + 1 }}&nbsp;</a>
26
+            <a class="{{ p == page ? 'pagination-current' : 'pagination-not-current'}}" href="" ng-repeat="p in pages" ng-click="loadPage(p)">{{ p + 1 }}&nbsp;</a>
27
         </div>
27
         </div>
28
 
28
 
29
     </div>
29
     </div>

Loading…
Cancel
Save