Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

Apologies, the title is horrifically worded.

Background

I have an angular app which I am using as a static display. There is no user interaction so most is based on timeouts. Page is loaded, after X amount of time based on X elements, the page reloads.

Issue

I want to show/hide only portions at at time. For example, one hundred results and I show 10, wait ten seconds, then show the next ten. Again, no user input though.

I am having trouble sorting the elements and hiding/displaying. From my understanding, I believe it is best to use a filter for this similar to pagination with buttons but then how do I trigger that automatically?

I use a JavaScript function to handle fade outs and window reset but I am lost. I need something like..

<div ng-repeat="item in filtered = items | filter:search | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit"> -->

DEMO of Progress

Plunkr: https://plnkr.co/edit/fZcHLTTjMLgLEHkZW3Dh?p=preview

share|improve this question
up vote 0 down vote accepted

If you upgrade to AngularJS v1.4.0 or higher, you can use the limitTo filter to get the behavior you want.

<li class="visible" ng-repeat="x in items | limitTo:entryLimit:entryLimit*currentPage">

you can manipulate entryLimit and currentPage with$timeout as you please to play around with the page number and page size.

AngularJS v1.4.0 limitTo filter doc

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.