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:
Andy Joslin
2014-03-11 16:26:59 -06:00
parent e4032339ec
commit 573df56db4
7 changed files with 228 additions and 81 deletions

View File

@@ -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);
}
}