Http get iterate over parts of data


#1

Im using http get like so:

this.http.get(url).map(res => res.json()).subscribe(
data => {

Now I want to loop through say row 10-20 (out of total 100) of above data set and push it to the view, but can’t figure out how to (I can only dump all of data in one shot through this.items=data etc).

Thanks for any pointers!


#2

You maybe want to build a lazy loading view list? Then have a look at Infinite scroll


#3

Thanks.

Yes, exactly. Im trying to build that around a http get request. But instead of calling a http get each time on load more, I want to load all data once, then iterate over that data for each load more. Hope that makes sense…


#4

If I understand correctly you want to load everything in memory and just use infinite scroll for the display right? So I guess you will have to manage to collections/array. One you load at the begin once with all your data and another were you concat the data step by step … just an idea


#5

Thanks.

Yes, exactly. I managed to in Ionic 1, but can’t figure out the correct way in Ionic 2.


#6

Well then, could you show us your code?