2

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

Solution

The limitTo and startFrom directives worked perfectly, in my controller I setup a $interval using the angular service and iterated "pages"..

startFrom:currentFlowerPage*flowerPageSize | limitTo: flowerPageSize

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.