国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

AngularJS Boostrap Pagination Sample

2019-11-15 02:32:04
字體:
供稿:網(wǎng)友
AngularJS Boostrap Pagination Sample

首先,樣式是這樣的

image

首先,Service端是Webapi REST JSON格式

第二,我們建立一個Wrapper Class,這里你也可以定義一個Generic<T>,作為示例,我們這里直接使用List<Employee>

image

image

后端分頁使用Entity Framework,這里呢,pageSize我們默認(rèn)為5,

image

示例的JSON結(jié)果

image

然后我們要引用兩個AngularJS,一個是AngularJS本身,一個是AngularJS Boostrap

PM> Install-Package angularjs

PM> Install-Package Angular.UI.Bootstrap

image

剩下的就是代碼了

<h3>This is done by AngularJS</h3><ul>    <script>        angular.module('myApp', ['ui.bootstrap']);               function pagerCtrl($scope, $http) {            $scope.maxSize = 5;            $scope.bigCurrentPage = 1;            $scope.setPage = function (pageNo) {                $scope.bigCurrentPage = pageNo;            };            $scope.$watch(                "bigCurrentPage",                function(newValue, oldvalue) {                    doPaging(newValue);                                  }            );            $scope.init = function (pageIndex) {                doPaging(pageIndex);            };            function doPaging(pageIndex) {                var url = "/api/employee/page/" + pageIndex;                $http.get(url).success(function (data) {                    $scope.employeeList = data;                    var number = new Number(data.TotalCount);                    //alert(number);                    $scope.bigTotalItems = number;                });            }        }    </script></ul><div class="container" ng-app="myApp" ng-controller="pagerCtrl">    <table data-ng-init="init(1)">        <tr>            <td>First Name</td>            <td>Last Name</td>        </tr>        <tr ng-repeat="item in employeeList.Employees">            <td>{{item.FirstName}}</td>            <td>{{item.LastName}}</td>        </tr>    </table>    <pagination total-items="bigTotalItems" items-per-page="5" page="bigCurrentPage"  class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination>    <PRe>Page: {{bigCurrentPage}} / {{numPages}}</pre></div>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 萨迦县| 濮阳县| 天水市| 瑞安市| 随州市| 沂水县| 景德镇市| 高邑县| 芜湖市| 江陵县| 舞钢市| 微山县| 延庆县| 桓仁| 阿勒泰市| 白水县| 宕昌县| 百色市| 建平县| 台江县| 嵊州市| 石嘴山市| 九江县| 通渭县| 连山| 平远县| 和硕县| 炉霍县| 丰都县| 石阡县| 沂水县| 林州市| 贵溪市| 商城县| 开平市| 双峰县| 高淳县| 霍城县| 宜宾县| 错那县| 安顺市|