瀏覽代碼

users pagination improvement

develop
Robin Thoni 9 年之前
父節點
當前提交
9f46dcdcbc
共有 2 個文件被更改,包括 4 次插入9 次删除
  1. 3
    8
      luticate/controllers/users.controller.js
  2. 1
    1
      luticate/views/users.html

+ 3
- 8
luticate/controllers/users.controller.js 查看文件

@@ -11,11 +11,12 @@ angular.module('luticate')
11 11
                 groups: ['userList']
12 12
             };
13 13
 
14
-            $scope.loadUsers = function()
14
+            $scope.loadPage = function(page)
15 15
             {
16 16
                 luticateAuthUsers.getAll({page: $scope.page, perPage: $scope.perPage}, promiseUsers)
17 17
                     .then(function(users)
18 18
                     {
19
+                        $scope.page = page;
19 20
                         $scope.users = users;
20 21
                         $scope.pages = [];
21 22
                         var start = Math.max(0, $scope.page - 5);
@@ -28,11 +29,5 @@ angular.module('luticate')
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 查看文件

@@ -23,7 +23,7 @@
23 23
         </table>
24 24
 
25 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 27
         </div>
28 28
 
29 29
     </div>

Loading…
取消
儲存