mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(ionRefresher): allow custom text & icons
Closes #760 BREAKING CHANGE: on-refresh and on-refresh-opening are no longer on the ion-content directive. They are on the ion-refresher. In addition, on-refresh-opening has been renamed to on-pulling. Change your code from this: ```html <ion-content on-refresh="onRefresh()" on-refresh-opening="onRefreshOpening()"> <ion-refresher></ion-refresher> </ion-content> ``` To this: ```html <ion-content> <ion-refresher on-refresh="onRefresh()" on-pulling="onRefreshOpening()"> </ion-refresher> </ion-content> ```
This commit is contained in:
@@ -36,28 +36,36 @@ angular.module('ionic.ui.scroll')
|
||||
scrollView.resize();
|
||||
}
|
||||
|
||||
this.setRefresher = function(refresherScope, refresherElement) {
|
||||
var refresher = this.refresher = refresherElement;
|
||||
var refresherHeight = self.refresher.clientHeight || 0;
|
||||
scrollView.activatePullToRefresh(refresherHeight, function() {
|
||||
refresher.classList.add('active');
|
||||
refresherScope.$onRefreshOpening();
|
||||
}, function() {
|
||||
refresher.classList.remove('refreshing');
|
||||
refresher.classList.remove('active');
|
||||
}, function() {
|
||||
refresher.classList.add('refreshing');
|
||||
refresherScope.$onRefresh();
|
||||
});
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
scrollView.run();
|
||||
|
||||
self.refresher = element.querySelector('.scroll-refresher');
|
||||
|
||||
// Activate pull-to-refresh
|
||||
if(self.refresher) {
|
||||
var refresherHeight = self.refresher.clientHeight || 0;
|
||||
scrollView.activatePullToRefresh(refresherHeight, function() {
|
||||
self.refresher.classList.add('active');
|
||||
$scope.$onRefreshOpening && $scope.$onRefreshOpening();
|
||||
}, function() {
|
||||
self.refresher.classList.remove('refreshing');
|
||||
self.refresher.classList.remove('active');
|
||||
}, function() {
|
||||
self.refresher.classList.add('refreshing');
|
||||
$scope.$onRefresh && $scope.$onRefresh();
|
||||
$scope.$parent.$broadcast('scroll.onRefresh');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
})();
|
||||
|
||||
var popups = [];
|
||||
function showPopup() {
|
||||
var newPopupDeferred = $q.defer();
|
||||
$q.all(popups).then(showThisPopup);
|
||||
|
||||
popups.push(newPopupDeferred);
|
||||
|
||||
function showThisPopup() {
|
||||
popups.splice(popups.indexOf(newPopupDeferred.promise), 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user