Angular pagination paging paging parameters only processing module does not process paging data record

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>angular demo-9 分页功能</title>
 6     <script src="../plugins/angularjs/angular.min.js"></script>
 7 
 8     <!-- 分页插件 -->
 9     <link href="../plugins/angularjs/pagination.css">
10     <script src="../plugins/angularjs/pagination.js"></script>
11     <!-- 分页插件/ -->
12 
13     <script>
14         var demo = angular.module("demoModule", ['pagination']);
15         demo.controller("demoController", function ($scope, $http) {
16             $scope.paginationConf = {
17                 currentPage: 1,
 18 is                  itemsPerPage: 2 ,
 . 19                  totalItems: 10 ,
 20 is                  the onChange: function () {
 21 is                      // Alert ( "changed"); 
22 is                      the console.log ( " changed " );
 23 is                  }
 24              };
 25              / * 
26 is                  the pagination features:
 27                      1-way binding
 28                          change the corresponding variable, then paging bar will change accordingly.
29                         currentPage itemsPerPage totalItems are two-way binding
 30                      change will be a change
 31                      2. does not deal with record data, updating the page record data is to be done by ourselves.
32                 Note:
 33 is                      the pagination function and no recording relationship data, to provide only the processed paging parameters.
34                  to update the data recording surface must be done by our own
 35               * / 
36              $ scope.increTotalItems =  function () {
 37 [                  the console.log ($ scope.paginationConf.totalItems);
 38 is  
39                  $ scope.nameList.push ( " Bei "  + scope.nameList.length $);
 40                 $scope.paginationConf.totalItems = $scope.nameList.length;
41 
42                 // $scope.paginationConf.totalItems = $scope.paginationConf.totalItems + 1;
43                 console.log($scope.paginationConf.totalItems);
44             };
45 
46             $scope.nameList = ["孙权", "刘备", "曹操", "大乔", "小乔"];
47 
48         });
49     </script>
50 
51 </head>
52 <body ng-app="demoModule" ng-controller="demoController">
53 
54     <!--<p ng-repeat="name in nameList">{{name}}</p>-->
55 
56     <table>
57         <tr ng-repeat="name in nameList" ng-model="nameList">
58             <td>{{name}}</td>
59         </tr>
60     </table>
61 
62     <input type="button" ng-click="increTotalItems()" value="自增">
63     <input ng-model="paginationConf.currentPage">
64     <input ng-model="paginationConf.itemsPerPage">
65 
66     <tm-pagination conf="paginationConf"></tm-pagination>
67 </body>
68 </html>
Angular pagination pagination module

 

Guess you like

Origin www.cnblogs.com/mozq/p/11105810.html