I Added an ion0refresher inside a list. But Every time I scroll that list, up or down, every time it call the refresh event.
If the user didnt pull the list to refresh, everthing works great, but if he pulls to refresh, every time him scroll the listm the method would be invoqued.
<ion-content>
<ion-refresher pulling-text="Arraste para refresh..." on-refresh="refresh()"></ion-refresher>
<div class="list">
<a class="item item-avatar contacts-item" href="#/home/contacts/{{contact.id}}" collection-repeat="contact in contacts | filter :searchField" collection-item-height="68" collection-item-width="'100%'">
<img ng-src="{{contact.photo}}">
<h2>{{contact.name}}</h2>
<p>{{contact.area}}</p>
</a>
</div>
</ion-content>
Just threw together a codepen and things are working fine. Could it be an issue with your function?
<ion-content>
<ion-refresher on-refresh="doRefresh()"
pulling-text="Pull to refresh..."
refreshing-text="Refreshing!"
refreshing-icon="ion-loading-c">
</ion-refresher>
<ion-list>
<ion-item ng-repeat="item in items">{{item}}</ion-item>
</ion-list>
</ion-content>
1 Like
That happens if you forget this line in doRefresh():
$scope.$broadcast('scroll.refreshComplete');
4 Likes
iam also facing this issue.
html:
<ion-refresher pulling-text="Pull to refresh..." spinner="bubbles" style="height:75px;width: 63%;" on-refresh="doRefresh()"> </ion-refresher>
.js file:
$scope.doRefresh = function() {
console.log('refreshing');
var url = "https://" + $scope.userdetaildata.subdomain + "/purchaseorder/" + $scope.poid;
var config = {
headers: {
"Authorization": 'Bearer ' + $scope.accesstokens.accesstoken,
"Auth-Token": 'Bearer ' + $scope.accesstokens.accesstoken,
"clienttype": "mobile",
"Content-type": "application/json; charset=utf-8"
}
};
$http.get(url, config)
.success(function(responsedata) {
$scope.$broadcast('scroll.refreshComplete');
if (responsedata.response.result == 'success') {
$scope.podetail = responsedata.data;
} else {
ionicToast.show(responsedata.response.message, 'bottom', true, 1500);
}
})
.error(function(data) {
$scope.$broadcast('scroll.refreshComplete');
ionicToast.show('Error In Fetching Data', 'bottom', false, 2000);
});
};
while pulling, spinner icon is continously spinning but dorefresh() is not fired. i dont know what iam missing. thanks in advance.