Re: [angular.js] ng-repeat by range

6,490 views
Skip to first unread message

Pawel Kozlowski

unread,
Jul 13, 2012, 1:45:43 PM7/13/12
to ang...@googlegroups.com
hi!

Would the limitTo filter
(http://docs.angularjs.org/api/ng.filter:limitTo) be enough tor you?
Here is the example: http://jsfiddle.net/pkozlowski_opensource/5zYjq/1/

Cheers,
Pawel

On Fri, Jul 13, 2012 at 7:32 PM, Luciano <luciano...@gmail.com> wrote:
> Hello.
>
> Is there a way to accomplish something like this:
>
> <li ng-repeat="item in [1 to results.totalPages]>{{item}}</li>
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/x9HtxVHcoLcJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.

Pawel Kozlowski

unread,
Jul 13, 2012, 2:05:52 PM7/13/12
to ang...@googlegroups.com
hi again!

On Fri, Jul 13, 2012 at 7:45 PM, Pawel Kozlowski
<pkozlowski...@gmail.com> wrote:
> hi!
>
> Would the limitTo filter
> (http://docs.angularjs.org/api/ng.filter:limitTo) be enough tor you?
> Here is the example: http://jsfiddle.net/pkozlowski_opensource/5zYjq/1/

hmm, now wondering, might have missed the point of your question...
are you after limiting the results displayed or more after generating
page navigation bar (and in this case more like have ngRepeat working
on a non-existing / virtual collection)?

If this is about 'page navigation' (and not limiting) it is true that
I don't see any easy solution... I mean - we could always generate a
temp array with numbers from 1 to results.totalPages... but this seems
wasteful...

Maybe you could simply iterate over a result and display $index for
each result? In any case it would be easier to help you if you could
send a jsFiddle with a sample of your data.

Cheers,
Pawel
Reply all
Reply to author
Forward
Message has been deleted
0 new messages