Disable ion-refresher temporary

Hi

I’ve tried it with <ion-refresher ng-if="refresheractive" ...></ion-refresher> and ‘refresheractive’ is set either tp true or false in the controller.

It works perfectly well until the refresher function is triggered once. After that it will trigger always, even if refresheractive is set to false (but the refresher is hidden).

Is there a more reliable way to disable the ion-refresher temporary?

Thank you!

Can you put a codepen together? I can take a look at it and figure out what the issue is.

Hi @mhartington and thanks for having a look.

Here is the codepen: http://codepen.io/anon/pen/CAEJs

I have some additional questions that I don’t understand:

  1. Why does the refresher add a padding at the top if enabled?
  2. Why can I see the enabled refresher if the attr padding="true" is removed from <ion-content>?
  3. Why is there a gap on the top after disabling the refresher?

Thanks again for your help!

Alright…

  1. Padding at top - You need to wrap the list content with an ion-list

ion-refresher - Directive in module ionic - Ionic Framework

  1. Not sure what you mean about this. See my updated codepen

http://codepen.io/mhartington/pen/DbdfI

  1. This is related to the overall issue.

And for being able to still PTR, I’m looking into this further. This is an issue so I’ll get in touch with the devs about it.

Hey thanks! I didn’t knew that the <ion-list> is necessary, but now it works and the 2. point is fixed too.

And thanks for letting the devs know about the issue.

Hi this is still an issue in Ionic v1.0.1 (pull to refresh remains enabled once activated first time even if ng-if evaluates to false thereafter) is someone looking into this?

I also need this behavior. Would be great if ion-refresher supports something like ng-disabled.

If you want to disable ion-refresher temporary you have to add :

  • an ng-if directive
  • a condition on your on-refresh method to recalculate the size of the scrollView container

<ion-refresher ng-if="canRefresh" class="refresher" pulling-icon="ion-load-c" spinner="spiral" on-refresh="refreshView()"></ion-refresher>

$scope.refreshView = function() {
if (canRefresh) {
//refresh
} else {
$ionicScrollDelegate.resize();
}
};