博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
angularjs 利用filter进行表单查询及分页查询
阅读量:6995 次
发布时间:2019-06-27

本文共 1154 字,大约阅读时间需要 3 分钟。

页面:

{
{item.imageLength/1024 | number:0}}KB
{
{item.imageName}}

 

这里主要说的是查询的数据结构:$scope.imagePaths=

{"imageinfo":

[{

imageLength"19505",imageName"company_logo.png"},

{imageLength"116010",imageName"crashed_icon.png"},

{imageLength"116411",imageName"logo.png"}

],"page":{size:2,index:1}};

需增加两个自定义的过滤器:

ng.module('index-filters', [])       .filter('paging',function(){            return function (items, index, pageSize) {                if (!items)                return [];                var offset = (index - 1) * pageSize;                return items.slice(offset, offset + pageSize);            }        })        .filter('size',function(){            return function (items) {                if (!items)                return 0;                return items.length || 0            }        })

 

效果如图:

转载于:https://www.cnblogs.com/bobo-show/p/5126775.html

你可能感兴趣的文章