Re: [AngularJS] pagination with jsonp api callback

65 views
Skip to first unread message

Ziobudda

unread,
Apr 30, 2014, 3:23:09 AM4/30/14
to ang...@googlegroups.com

Il giorno 30/apr/2014, alle ore 08:17, Tha Sophearak <t.sop...@gmail.com> ha scritto:

I want to create pagination by using api callback count and offset.
I can fetch that, but don't know how to implement with pagination.

Hi, start from here: 


M.

--
Davide Morelli




Sander Elias

unread,
Apr 30, 2014, 11:03:24 PM4/30/14
to ang...@googlegroups.com
Hi Tha,

What I am missing in your code is the total number of items available in the collection. Without that, you can't calculate the number of pages.
the only thing you can do if that is not available is count what you know off. this means you can only page back to the data you got earlier.
Is that what you are trying to do?

Regards
Sander

Sander Elias

unread,
Apr 30, 2014, 11:18:45 PM4/30/14
to ang...@googlegroups.com
Hi Tha,

I updated your plunker to implement the thing I talked about in my previous message. I left the implementation of the setPage and previous button for yourself.
If you can get the maxItems from the server, you are pretty much done.

Regards
Sander

Gabriel Aszalos

unread,
May 1, 2014, 4:23:43 AM5/1/14
to ang...@googlegroups.com
It would be ideal to only put items that are connected to the view inside the $scope. There is no point in having that "getJSON" function in there, it'll just add extra operations to the digest cycle.

On Thursday, 1 May 2014 07:09:15 UTC+1, Tha Sophearak wrote:
thanks you very much, I'm nearly out of that right now.

Sander Elias

unread,
May 1, 2014, 4:46:20 AM5/1/14
to ang...@googlegroups.com
Hi Tha,

forgot to put in a link to the new plunk: http://plnkr.co/edit/DfWQtrV0vddSbe3aPZAj?p=preview

Regards
Sander

Sander Elias

unread,
May 1, 2014, 9:21:26 AM5/1/14
to ang...@googlegroups.com
Tha,

I don't get it, that just works. what is is where you are after?

Sander Elias

unread,
May 1, 2014, 9:30:11 AM5/1/14
to ang...@googlegroups.com

Tha,

I guess you need to look at <a ng-href='/api/v10/items/{{item.id}}'>

Regards
Sander

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