Answer the question
In order to leave comments, you need to log in
How to get big json file in chunks, Angularjs?
Good day.
The task is as follows:
1. There is a very large json file, it contains more than 6k objects, each of which has 20-30 fields, the weight is 12mb.
2. Accordingly, this is the whole point, it takes a very long time to load on the site, about 1 minute, maybe more ...
Question:
1. How to receive json partially? For example, by clicking on the Show more button or when scrolling the page.
2. What other options for processing such data.
3. I heard that the lodash library has a filter for cutting the resulting json, but I can’t find it.
ps this is how i get the data
$http.get(url).success(function(data, status, headers, config){
//console.log('data', data);
$scope.bike = data;
});
Answer the question
In order to leave comments, you need to log in
I think you need to set up a RESTful Api for this request.
For example, now the //some.url request returns json with 6k records
. If you implement processing of urls like //some.url/?page=1&perpage=20 on the backend,
you will be able to flexibly receive a certain number of elements (in this case, in the first iteration first 20 elements).
My proposal does not dispute the above, but simply complements
Tell me what is the problem? In my opinion, your client does not need all 6000 objects. for a detailed output of data about each, you need 20-30 in a package and additional loading if necessary.
IM website. The client needs 6000 objects.) The whole question is how to get these 20-30 objects and then load all the rest as needed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question