feat(Ion): Base component class

This commit is contained in:
Max Lynch
2015-06-30 10:46:36 -05:00
parent 1927cb8bb1
commit 39bd7efdfd
8 changed files with 38 additions and 18 deletions

View File

@@ -2,6 +2,8 @@ import {ElementRef} from 'angular2/angular2'
import {Component} from 'angular2/src/core/annotations_impl/annotations';
import {View} from 'angular2/src/core/annotations_impl/view';
import {Ion} from '../ion';
@Component({
selector: 'ion-content'
@@ -9,15 +11,12 @@ import {View} from 'angular2/src/core/annotations_impl/view';
@View({
template: `<div class="scroll-content"><content></content></div>`
})
export class Content {
export class Content extends Ion{
constructor(elementRef: ElementRef) {
// TODO(maxlynch): we need this nativeElement for things like aside, etc.
// but we should be able to stamp out this behavior with a base IonicComponent
// or something, so all elements have a nativeElement reference or a getElement() method
this.ele = elementRef.nativeElement;
super(elementRef);
setTimeout(() => {
this.scrollElement = this.ele.children[0];
this.scrollElement = elementRef.nativeElement.children[0];
});
}