Hi All, I am wondering how I can trigger the pull to refresh function using ionViewDidEnter().
I can easily just call my doRefresh() function in the ionViewDidEnter() method, but how can I pass in a $event object so that refresher.complete(); can still be called at the end of it.
ts
ionViewDidEnter() {
this.doRefresh(); -- I need to pass in here somehow
}
doRefresh(refresher) {
this.notificationservice.refreshNotifications().then((response) => {
response = JSON.parse(response['_body']);
let notifications = new Array();
for(let key in response)
{
response[key].dateago = moment(response[key].date, 'YYYY-MM-DD H:mm:ss').fromNow();
notifications[key] = response[key];
}
this.notifications = notifications;
this.notificationservice.notifications = notifications;
refresher.complete();
});
}
html
<ion-refresher (ionRefresh)="doRefresh($event);">
<ion-refresher-content pullingIcon="arrow-dropdown" pullingText="Pull to refresh" refreshingSpinner="circles" refreshingText="Refreshing...">
</ion-refresher-content>
</ion-refresher>