jeudi 10 août 2017

GET request with multiple pages in Ionic 2

So I'm trying to send a GET request to an API server in my Ionic 2 app, the returned JSON is too huge to be in one page, so the server divides it into pages, each with a different URL (Obviously).

My problem is that I don't know how to call the other page in the same request, I heard that using Infinite Scroll will help, and I looked at the official docs, but I was still unable to solve my problem.

Here's my code for the App.ts:

  constructor(public navCtrl: NavController, public navParams: 
     NavParams,private http:Http) {

  this.http.get("http://linkofAPI")
    .subscribe(data => {
      // console.log(data['_body']);
      this.items = JSON.parse(data['_body']).data;//Bind data to items object
      console.log(this.items);
    }, error => {
      console.log(error);// Error getting the data
    });
}

And my App.html

  <ion-item class="items" *ngFor="let item of items; let i=index">

  <h3 dir="rtl"></h3>

Aucun commentaire:

Enregistrer un commentaire