diff --git a/ionic/components/content/content.ts b/ionic/components/content/content.ts
index 4ddb68d26b..7ffb3261d2 100644
--- a/ionic/components/content/content.ts
+++ b/ionic/components/content/content.ts
@@ -1,5 +1,6 @@
import {Component, ElementRef, Optional, NgZone} from 'angular2/core';
+import {Ion} from '../ion';
import {IonicApp} from '../app/app';
import {Config} from '../../config/config';
import {raf} from '../../util/dom';
@@ -31,7 +32,7 @@ import {ScrollTo} from '../../animations/scroll-to';
'' +
''
})
-export class Content {
+export class Content extends Ion {
private _padding: number = 0;
private _scrollEle: HTMLElement;
private _onScroll: any;
@@ -48,6 +49,8 @@ export class Content {
private _zone: NgZone,
@Optional() viewCtrl: ViewController
) {
+ super(_elementRef);
+
if (viewCtrl) {
viewCtrl.setContent(this);
viewCtrl.setContentRef(_elementRef);
@@ -275,7 +278,7 @@ export class Content {
* {Number} dimensions.scrollLeft scroll scrollLeft
* {Number} dimensions.scrollRight scroll scrollLeft + scrollWidth
*/
- getDimensions() {
+ getContentDimensions() {
let _scrollEle = this._scrollEle;
let parentElement = _scrollEle.parentElement;
@@ -303,9 +306,9 @@ export class Content {
* Adds padding to the bottom of the scroll element when the keyboard is open
* so content below the keyboard can be scrolled into view.
*/
- add_padding(newPadding) {
+ addScrollPadding(newPadding) {
if (newPadding > this._padding) {
- console.debug('content add padding', newPadding);
+ console.debug('content addScrollPadding', newPadding);
this._padding = newPadding;
this._scrollEle.style.paddingBottom = newPadding + 'px';
diff --git a/ionic/components/input/input.ts b/ionic/components/input/input.ts
index 68da16ca99..3a81f795e2 100644
--- a/ionic/components/input/input.ts
+++ b/ionic/components/input/input.ts
@@ -276,7 +276,7 @@ export class ItemInput {
// find out if text input should be manually scrolled into view
let ele = this._elementRef.nativeElement;
- let scrollData = ItemInput.getScrollData(ele.offsetTop, ele.offsetHeight, scrollView.getDimensions(), this.keyboardHeight, this._platform.height());
+ let scrollData = ItemInput.getScrollData(ele.offsetTop, ele.offsetHeight, scrollView.getContentDimensions(), this.keyboardHeight, this._platform.height());
if (scrollData.scrollAmount > -3 && scrollData.scrollAmount < 3) {
// the text input is in a safe position that doesn't require
// it to be scrolled into view, just set focus now
diff --git a/ionic/components/scroll/pull-to-refresh.ts b/ionic/components/scroll/pull-to-refresh.ts
index 3e6a3a9f6c..fef1b85fb1 100644
--- a/ionic/components/scroll/pull-to-refresh.ts
+++ b/ionic/components/scroll/pull-to-refresh.ts
@@ -1,8 +1,9 @@
-import {Component, ElementRef, EventEmitter, Host} from 'angular2/core'
+import {Component, ElementRef, EventEmitter, Host, Input, Output} from 'angular2/core'
import {NgIf, NgClass} from 'angular2/common';
import {Content} from '../content/content';
-import * as util from '../../util';
+import {Icon} from '../icon/icon';
+import {isDefined, defaults} from '../../util/util';
import {raf, ready, CSS} from '../../util/dom';
@@ -61,15 +62,6 @@ import {raf, ready, CSS} from '../../util/dom';
*/
@Component({
selector: 'ion-refresher',
- inputs: [
- 'pullingIcon',
- 'pullingText',
- 'refreshingIcon',
- 'refreshingText',
- 'spinner',
- 'disablePullingRotation'
- ],
- outputs: ['refresh', 'starting', 'pulling'],
host: {
'[class.active]': 'isActive',
'[class.refreshing]': 'isRefreshing',
@@ -78,74 +70,67 @@ import {raf, ready, CSS} from '../../util/dom';
template:
'
' +
'
' +
- '' +
+ '' +
'
' +
'
' +
'
' +
- '' +
+ '' +
'
' +
'
' +
'
',
- directives: [NgIf, NgClass]
+ directives: [NgIf, NgClass, Icon]
})
export class Refresher {
- /**
- * @private
- * @param {Content} content TODO
- * @param {ElementRef} elementRef TODO
- */
+ private ele: HTMLElement;
+
+ isDragging: boolean = false;
+ isOverscrolling: boolean = false;
+ dragOffset: number = 0;
+ lastOverscroll: number = 0;
+ ptrThreshold: number = 0;
+ activated: boolean = false;
+ scrollTime: number = 500;
+ canOverscroll: boolean = false;
+
+ @Input() pullingIcon: string;
+ @Input() pullingText: string;
+ @Input() refreshingIcon: string;
+ @Input() refreshingText: string;
+ @Input() spinner: string;
+
+ @Output() pulling: EventEmitter = new EventEmitter();
+ @Output() refresh: EventEmitter = new EventEmitter();
+ @Output() starting: EventEmitter = new EventEmitter();
+
+
constructor(
- @Host() content: Content,
+ @Host() private content: Content,
element: ElementRef
) {
this.ele = element.nativeElement;
this.ele.classList.add('content');
-
- this.content = content;
-
- this.refresh = new EventEmitter('refresh');
- this.starting = new EventEmitter('starting');
- this.pulling = new EventEmitter('pulling');
}
/**
* @private
*/
ngOnInit() {
- this.initEvents();
- }
-
- /**
- * @private
- * Initialize touch and scroll event listeners.
- */
- initEvents() {
-
let sp = this.content.getNativeElement();
let sc = this.content.scrollElement;
- this.isDragging = false;
- this.isOverscrolling = false;
- this.dragOffset = 0;
- this.lastOverscroll = 0;
- this.ptrThreshold = 60;
- this.activated = false;
- this.scrollTime = 500;
this.startY = null;
this.deltaY = null;
- this.canOverscroll = true;
this.scrollHost = sp;
this.scrollChild = sc;
- util.defaults(this, {
- pullingIcon: 'ion-android-arrow-down',
- refreshingIcon: 'ion-ionic'
- //refreshingText: 'Updating'
+ defaults(this, {
+ pullingIcon: 'md-arrow-down',
+ refreshingIcon: 'ionic'
})
- this.showSpinner = !util.isDefined(this.refreshingIcon) && this.spinner != 'none';
+ this.showSpinner = !isDefined(this.refreshingIcon) && this.spinner != 'none';
- this.showIcon = util.isDefined(this.refreshingIcon);
+ this.showIcon = isDefined(this.refreshingIcon);
this._touchMoveListener = this._handleTouchMove.bind(this);
this._touchEndListener = this._handleTouchEnd.bind(this);
@@ -280,7 +265,7 @@ export class Refresher {
// return to native scrolling after tail animation has time to finish
setTimeout(() => {
- if(this.isOverscrolling) {
+ if (this.isOverscrolling) {
this.isOverscrolling = false;
this.setScrollLock(false);
}
diff --git a/ionic/components/text-input/text-input.ts b/ionic/components/text-input/text-input.ts
index 368a401a84..b014269053 100644
--- a/ionic/components/text-input/text-input.ts
+++ b/ionic/components/text-input/text-input.ts
@@ -60,7 +60,7 @@ export class TextInput {
this.element().focus();
}
- relocate(shouldRelocate, inputRelativeY) {
+ relocate(shouldRelocate: boolean, inputRelativeY?) {
if (this._relocated !== shouldRelocate) {
let focusedInputEle = this.element();