2

trying to call ion-refresher's function programatically by calling the function name: 'doRefresh(refresher)' , it works fine when pull down from the view as the event (refresher) is being passed.

now I would like to trigger doRefresher programatically, which I tried and it works but fails on "refresher.complete()" as the refresher is not passed, How do i pass the refresher?

(home.ts) Do refresher method:

doRefresh(refresher?) {

let d = get_data();

 if (d == "d"){
    refresher.complete();
  }else{
    console.log('value is not d')
    refresher.complete()
  }
}

(home.ts) ionviewdidload

ionViewDidLoad(){
  this.doRefresh();
}

html:

   <ion-refresher (ionRefresh)="doRefresh($event);">
   <ion-refresher-content 
      pullingText="Pull to refresh" pullingIcon="arrow-dropdown" 
      refreshingSpinner="circles"
   refreshingText="..fetching">
   </ion-refresher-content> 
   </ion-refresher>

Would like to know how can I pass "refresher" to the doRefresh() method?

mike
  • 375
  • 2
  • 14

0 Answers0