<p> forms </p><!--new Bootstrap core CSS file--><div id="Divmain"><tableclass="Table Table-bordered"><tbody><tr><td>{{item.appName}}</td><td>{{item.linkObjectName}}</td> <td>{{item.linkaddress}}</td><td><buttonclass="Btn_orange"> Generate two-dimensional code </button></td><td><buttonclass="Btn_orange"> Delete </button></td></tr></tbody></table><ulclass="pagination"><li><a> <span> Previous </span> </a></li><li><a>{{page}}</a> </li><li><a> <span> Next </span> </a></li></ul></div>< Script Type="Text/javascript"Src="Angular.js"></script><script type="Text/javascript">//<! [Cdata[ varApp = Angular.module ("myApp", []); App.controller ("Myctrl", function ($scope, $http) {$http.Get("Service.js"). Then (function (response) {//Data Source$scope. Data =response.data.records;//total number of pages$scope. pageSize =5; $scope. Pages= Math.ceil ($scope. data.length/$scope. pageSize);//Number of pages$scope. newpages = $scope. Pages >5?5: $scope. pages; $scope. PageList= []; $scope. Selpage=1;//set up a tabular data source (paging)$scope. SetData =function () {$scope. Items= $scope. Data.slice ($scope. PageSize * ($scope. Selpage-1)), ($scope. Selpage * $scope. pageSize));//filter out the current page display data by the current number of pages} $scope. Items= $scope. Data.slice (0, $scope. pageSize);//the array to repeat for paging for(vari =0; I < $scope. Newpages; i++) {$scope. Pagelist.push (i+1); }//Prints the index of the currently selected page$scope. Selectpage =function (page) {//cannot be less than 1 greater than maximum if(Page <1|| Page > $scope. Pages)return;//display up to 5 of pages if(Page >2) {//because only 5 pages are displayed, more than 2 pages start the paging conversion varNewpagelist = []; for(vari = (Page-3) ; I < (page +2) > $scope. pages? $scope. Pages: (page +2)) ; i++) {Newpagelist.push (i+1); } $scope. pagelist=newpagelist; } $scope. selpage=page; $scope. SetData (); $scope. Isactivepage (page); Console.log ("selected page:"+page); };//set the currently selected page style$scope. Isactivepage =function (page) {return$scope. Selpage = =page; };//Previous Page$scope. Previous =function () {$scope. Selectpage ($scope. Selpage-1); }//Next Page$scope. Next =function () {$scope. Selectpage ($scope. Selpage+1); }; }); })//]]></script>
Angularjs Sub-page