本文介绍了"表现出更多的"在角功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我的英语
我在角度和JS新

Sorry for my englishI'm new in angular and JS

我创造了这个木板 - http://plnkr.co/edit/stDVowlSq7e5wUw5YwHN?p=$p$pview
我怎么能添加显示更多功能,例如像这样 http://jsfiddle.net/HPu9n/44/ 在我的板材例如,在

I created this plank - http://plnkr.co/edit/stDVowlSq7e5wUw5YwHN?p=previewhow I can add the "show more" function such like this http://jsfiddle.net/HPu9n/44/ in my plank example, in:

angular.module('module3', [])
.controller('testCtrl3', function($scope){
$scope.query = {}
$scope.queryBy = '$'
$scope.items = [
  {
    "name" : "Ananchenko Juriy",
    "company" : "GOOGLE. Ltd",
    "designation" : "Creativ Director"
  },
  {
    "name" : "Ananchenko",
    "company" : "GOOGLE"
  },
  {
    "name" : "Korman Juriy",
    "company" : "GOOGLE. Ltd",
    "designation" : "stager na ispitatelnom sroke"
  }
];
$scope.orderProp="name";

});

推荐答案

嗯,不知道如果我得到你的问题的权利...

Hmm, not sure if I get your question right ...

一切都是媒体链接那里的小提琴,你只需要把它复制到你的plunker。

Everything is allready there in the fiddle, you just need to copy it to your plunker.

有将是:
与过滤器的指令

There would be:The directive with the filter

<tr ng-repeat="emp in items | filter:query | limitTo: itemsLimit()">

和你的coressponding code控制器

and the coressponding code in you controller

var pagesShown = 1;
var pageSize = 2;
$scope.itemsLimit = function() {
    return pageSize * pagesShown;
};
$scope.hasMoreItemsToShow = function() {
    return pagesShown < ($scope.items.length / pageSize);
};
$scope.showMoreItems = function() {
    pagesShown = pagesShown + 1;
};

pageSize的设置为2演示目的。

pageSize is set to 2 for demonstration purpose.

这篇关于&QUOT;表现出更多的&QUOT;在角功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 07:13