Angular - How to get more results and append to list

24 views
Skip to first unread message

Steven Ottz

unread,
Nov 30, 2015, 12:34:19 AM11/30/15
to AngularJS
I am getting data via an external API using jsonp.

I have the data returned and displayed ok and I have the first 10 results showing.

If moreRequests in the API is set to true you can pass the cache location and session id to do an additional call to the API to fetch the next 10 results and so on until the results return false.

How do you do this and append the next set of 10 results in the list by making subsequent ajax calls?

Would it be better to just return the full json list and then use Angular to show results? Or try to make additional ajax calls each time?

Thanks

Vaibhav Gupta

unread,
Dec 1, 2015, 2:47:48 AM12/1/15
to AngularJS
Hi Steven,

If you are using ng-repeat, you can update the items and angular will update the UI. 

Would it be better to just return the full json list and then use Angular to show results? Or try to make additional ajax calls each time?

It depends on the following points:

1. Server performance: Is the server capable of fetching all the records without considerable performance issues? For instance, if data is fetched from a database, there might be lot of joins in tables to get all the data. This might not be performant. 
2. Client performance: If UI is complex for each row of data, client (browser) might become sluggish for large amount of data.  

Hope this helps.

Regards,

Vaibhav Gupta
Reply all
Reply to author
Forward
0 new messages