Skip to content

Instantly share code, notes, and snippets.

@ventouris
Created August 9, 2017 07:18
Show Gist options
  • Save ventouris/797c61c38727258040eb704c83c31613 to your computer and use it in GitHub Desktop.
Save ventouris/797c61c38727258040eb704c83c31613 to your computer and use it in GitHub Desktop.
getTransportations() {
let loader = this.loadingController.create({
content: 'Getting data...'
});
loader.present();
return this.wpApi.getTransportations(this.maxResults)
.then( (data) => {
if ( data.status == 200 ) {
this.transportantions = data.response.entries;
} else {
console.log('Something was wrong. Error status ' + data.status);
}
loader.dismiss();
})
.catch(function (err) {
loader.dismiss();
console.log('something was wrong: ' + err);
});
}
doInfinite(infiniteScroll:any) {
this.maxResults += 10;
this.getTransportations().then(()=>{
infiniteScroll.complete();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment