首先,样式是这样的

首先,Service端是Webapi REST JSON格式

第二,我们建立一个Wrapper Class,这里你也可以定义一个Generic<T>,作为示例,我们这里直接使用List<Employee>

后端分页使用Entity Framework,这里呢,pageSize我们默认为5,

示例的JSON结果

然后我们要引用两个AngularJS,一个是AngularJS本身,一个是AngularJS Boostrap

PM> Install-Package angularjs

PM> Install-Package Angular.UI.Bootstrap

剩下的就是代码了

<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>

AngularJS Boostrap Pagination Sample的更多相关文章

  1. 周赛-KIDx's Pagination 分类: 比赛 2015-08-02 08:23 7人阅读 评论(0) 收藏

    KIDx's Pagination Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) S ...

  2. flask实战-个人博客-编写博客前台

    编写博客前台 博客前台需要开放给所有用户,这里包括显示文章列表.博客信息.文章内容和评论等功能功能. 分页显示文章列表 为了在主页显示文章列表,我们要先在渲染主页模板的index视图的数据库中获取所有 ...

  3. AngularJs的UI组件ui-Bootstrap分享(五)——Pager和Pagination

    ui-bootstrap中有两个分页控件,一个是轻量级的Pager,只有上一页和下一页的功能,另一个是功能完整的Pagination,除了上一页和下一页,还可以选择首页和最后页,并且支持多种页数的显示 ...

  4. 第一个AngularJS Sample

    代码: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3. ...

  5. Getting Started with Django Rest Framework and AngularJS

    转载自:http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html A ReST ...

  6. angularjs和ajax的结合使用 (一)

    好久没写文了.这是一篇关于easyui配合ajax使用 的文章, 顺带介绍angularjs的使用 以及让你感受到angularjs的威力.网上对于ajax 的文也是多如牛毛 .我就不直接 从那种原生 ...

  7. 一些关于angularJS的自己学习和开发过程中遇到的问题及解决办法

    这篇文章也许会不定时更新,主要记录这段时间内自己遇到的angularjs学习开发的一些问题的解决办法.本文以摘抄为主,主要目的还是将自己遇到的困惑在各个地方查到的解决办法的汇总,给自己留个备忘吧. 1 ...

  8. 自定义angularjs分页控件

    继昨天写了knockoutjs+ jquery pagination+asp.net web Api 实现无刷新列表页 ,正好最近刚学习angularjs ,故琢磨着写一个angularjs版本的分页 ...

  9. 具备 jQuery 经验的人如何学习AngularJS(附:学习路径)

    这是一个来自stackoverflow的问答,三哥直接把最佳回答搬过来了. 都说AngularJS的学习曲线异常诡异~~~ Q: “Thinking in AngularJS” if I have a ...

随机推荐

  1. MemCacheManager

    #region Fields private AreaRepository _areaRepository = new AreaRepository(); private ICacheManager ...

  2. DBMS_LOB

    1.LOB背景 在现在的系统开发中,需要存储的已不仅仅是简单的文字信息,也包括一些图片.音像资料或者超长的文本,这要求后台数据库具有存储这些数据的能力,Oracle通过提供LOB对象实现了该功能. 2 ...

  3. How to Be Good at Mathematics

    How to Be Good at Mathematics Community Q&A Sometimes, the hardest subject for some people is ma ...

  4. [1.1]Knowledge that should be prepared

    Actually, there are a huge amount of knowledge we need to learn. So I hope you don't be scared. It's ...

  5. c# 反射学习笔记

    首先了解C#反射的概念,反射是一个运行库类型发现的过程.通过反射可以得到一个给定程序集所包含的所有类型的列表, 这个列表包括给定类型中定义的方法.字段.属性和事件.也可以动态的发现一组给定类支持的借口 ...

  6. delphi 05 图片和超链接

    超链接 /取消超链接 插入/取消 书签 插入图片 粘贴图上CTRL+v 截图 插入表情GIF WEB背景色 WEB背景图片      WebBrowser1.OleObject.document.ge ...

  7. Splash and Wizard

    https://github.com/xcz1899/AndroidGuide https://github.com/w446108264/XhsWelcomeAnim https://github. ...

  8. [MODX] 2. Chunks $

    Chunk in Modx can cut your template into samll pieces to make code reuseable. [[$chunk_name]] For ex ...

  9. Particle designer 粒子工具中属性对应功能的简单介绍

    粒子配置 Max Particles 粒子的数量  一般而言,我们的目标是用最少的粒子创造出所需的效果.单个粒子的大小对游戏运行效率也有很大的影响——单个粒子越小,性能越高. Lifespan 生命周 ...

  10. 终于找到了无毒版的fences1.0(2.0版本要收费的)

    今天终于安装了fences1.0,桌面不用那么乱哄哄的啦 我在博客里上传了安装文件,方便大家下载安装,这是无毒的哦,网上有很多都是不能通过病毒检测的. 地址如下:点击这里下载 使用方法: 创建块:安装 ...