diff --git a/ionic/components/content/content.ts b/ionic/components/content/content.ts
index 221070d453..4efc136f18 100644
--- a/ionic/components/content/content.ts
+++ b/ionic/components/content/content.ts
@@ -1,4 +1,4 @@
-import {Component, View, ElementRef} from 'angular2/angular2';
+import {Component, View, ElementRef, onInit} from 'angular2/angular2';
import {Ion} from '../ion';
@@ -7,7 +7,8 @@ import {Ion} from '../ion';
selector: 'ion-content',
properties: [
'parallax'
- ]
+ ],
+ lifecycle: [onInit]
})
@View({
template: '
+ template: `
`,
directives: [NgIf, CSSClass]
})
@@ -49,10 +50,10 @@ export class Refresher {
this.refresh = new EventEmitter('refresh');
this.starting = new EventEmitter('starting');
this.pulling = new EventEmitter('pulling');
+ }
- setTimeout(() => {
- this.initEvents();
- }, 1000);
+ onInit() {
+ this.initEvents();
}
initEvents() {
@@ -73,9 +74,11 @@ export class Refresher {
this.scrollParent = sp;
this.scrollChild = sc;
- if(!util.isDefined(this.pullingIcon)) {
- this.pullingIcon = 'ion-android-arrow-down';
- }
+ util.defaults(this, {
+ pullingIcon: 'ion-android-arrow-down',
+ refreshingIcon: 'ion-ionic'
+ //refreshingText: 'Updating'
+ })
this.showSpinner = !util.isDefined(this.refreshingIcon) && this.spinner != 'none';
@@ -149,7 +152,7 @@ export class Refresher {
start() {
// startCallback
this.isRefreshing = true;
- this.refresh.next();
+ this.refresh.next(this);
//$scope.$onRefresh();
}
@@ -164,6 +167,29 @@ export class Refresher {
this.ele.classList.add('invisible');
}
+ tail() {
+ // tailCallback
+ this.ele.classList.add('refreshing-tail');
+ }
+
+ complete() {
+ setTimeout(() => {
+ raf(this.tail.bind(this));
+
+ // scroll back to home during tail animation
+ this.scrollTo(0, this.scrollTime, this.deactivate.bind(this));
+
+ // return to native scrolling after tail animation has time to finish
+ setTimeout(() => {
+ if(this.isOverscrolling) {
+ this.isOverscrolling = false;
+ this.setScrollLock(false);
+ }
+ }, this.scrollTime);
+
+ }, this.scrollTime);
+ }
+
scrollTo(Y, duration, callback) {
// scroll animation loop w/ easing
// credit https://gist.github.com/dezinezync/5487119
diff --git a/ionic/components/scroll/test/pull-to-refresh/index.ts b/ionic/components/scroll/test/pull-to-refresh/index.ts
index 564af9a419..a11aba8903 100644
--- a/ionic/components/scroll/test/pull-to-refresh/index.ts
+++ b/ionic/components/scroll/test/pull-to-refresh/index.ts
@@ -11,8 +11,12 @@ class MyApp {
constructor() {
console.log('IonicApp Start')
}
- doRefresh() {
- console.log('DOREFRESH')
+ doRefresh(refresher) {
+ console.log('DOREFRESH', refresher)
+
+ setTimeout(() => {
+ refresher.complete();
+ })
}
doStarting() {
console.log('DOSTARTING');
diff --git a/ionic/components/scroll/test/pull-to-refresh/main.html b/ionic/components/scroll/test/pull-to-refresh/main.html
index d0e156f529..651800e5e1 100644
--- a/ionic/components/scroll/test/pull-to-refresh/main.html
+++ b/ionic/components/scroll/test/pull-to-refresh/main.html
@@ -2,7 +2,7 @@
Pull To Refresh
-
+
@@ -16,7 +16,6 @@