What's the best way to subscribe to ionRefresh event from the ion-refresher component


#1

Is there another way to subscribe to the ionRefresh event of the <ion-refresher>?

Why does the ion-refresher-content have the event instead of the ion-refresher ??

MyPage Template

<ion-content>
  <ion-refresher>
    <ion-refresher-content #refresher></ion-refresher-content>
  </ion-refresher>
</ion-content>

MyPage class

@Component({...})
export class MyPage(){
  @ViewChild('refresher') refresher;

  ionViewDidLoad(){
    this.refresher.r.ionRefresh.subscribe();
  }

}

ion-refresher component source:
https://github.com/driftyco/ionic/tree/master/src/components/refresher


#2

I use it as this way:

<ion-refresher (ionRefresh)="doRefresh($event)">
     <ion-refresher-content>
     </ion-refresher-content>
</ion-refresher>

==================================================

doRefresh(refresher) {
	console.log('Begin async operation', refresher);
	
	setTimeout(() => {
		this.reload();
		console.log('Async operation has ended');
		refresher.complete();            
	}, 1000);
}

reload(){
     //get newest data
}