How to limit the result coming from API in IONIC 3

#1

I am working on a project where I have to make a HTTP call in which I get a array of result whose length is 60+ and it takes a lot of time to load.

How can I limit the result & display the list of 20 array at first load and on scrolling down the other 20 and so on?

This is my .ts file

getUserList() {
        this.showLoader();
        this.authService.getData(this.search, "search")
          .then((result) => {
            let yourString = typeof result == 'object' && result["_body"] ? result["_body"] : [];
            let res = yourString.substring(1, yourString.length - 1);
            this.hideLoader();
            this.response = JSON.parse(res);
            console.log(this.response);
          }, (err) => {
            console.log(err);
          });
      }

this is the console.log(this.response)

50%20AM

How can i achieve this?

#2

That have to a change in the API call you use to fetch that data. Nothing in Ionic deals with that.

#3

Can u show me some example or any link where I can understand the workings ?

#4

You have to rewrite the API itself to accept an additional parameter that limits the result. There is nothing the Ionic, Angular, React or Vue can do about this. It is solely done in the coding of the API.