diff --git a/playground/tabs/main.js b/playground/tabs/main.js index f6097fcea9..f9a0870e2f 100644 --- a/playground/tabs/main.js +++ b/playground/tabs/main.js @@ -1,7 +1,9 @@ import {bootstrap} from 'angular2/core'; import {Component, Template} from 'angular2/angular2'; -import {View, Content} from 'ionic/components/view/view'; -import {Tabs, Tab} from 'ionic/components/tabs/tabs'; +import {View} from 'ionic/components/view/view'; +import {Content} from 'ionic/components/view/content'; +import {Tabs} from 'ionic/components/tabs/tabs'; +import {Tab} from 'ionic/components/tabs/tab'; @Component({ selector: '[ion-app]' }) @Template({ @@ -10,7 +12,7 @@ import {Tabs, Tab} from 'ionic/components/tabs/tabs'; }) class IonicApp { constructor() { - console.log('IonicApp Start'); + console.log('IonicApp Start') } } diff --git a/src/components/nav-view/nav-view.js b/src/components/nav-view/nav-view.js new file mode 100644 index 0000000000..c1a61a331e --- /dev/null +++ b/src/components/nav-view/nav-view.js @@ -0,0 +1,23 @@ +import {Ion} from '../ion' + +export class NavView extends Ion { + + // viewControllers: Stack; + // visibleViewController: ViewController; + + // push(viewController) { + // stack.push(viewController) + // } + // pop(viewController) { + // stack.pop(viewController) + // } + // set viewControllers(v) { + // this.viewControllers = v + // } + + constructor() { + console.log('construct nav-view') + this.history = [] // <---- would be fancy pants + } + +} diff --git a/src/components/tabs/tab.js b/src/components/tabs/tab.js new file mode 100644 index 0000000000..cc55d355a1 --- /dev/null +++ b/src/components/tabs/tab.js @@ -0,0 +1,44 @@ +import {NgElement, Component, Template, Parent} from 'angular2/angular2'; +import {Ion} from '../ion'; +import {Tabs} from './tabs'; +import {NavView} from '../nav-view/nav-view'; + +@Component({ + selector: 'ion-tab', + bind: { + tabTitle: 'tab-title' + } +}) +@Template({ + inline: ` +
+
+
+ +
+
+
+ ` +}) +export class Tab extends NavView { + + constructor(@NgElement() ele:NgElement, @Parent() tabs: Tabs) { + super(); + this.ele = ele; + + ele.domElement.classList.add('view'); + ele.domElement.classList.add('tab-view'); + + tabs.add(this); + + setTimeout(() => { + // HACK!!!!! "this" doesn't have tabTitle when not in setTimeout + console.log(this.tabTitle) + }) + + } + + show(shouldShow) { + this.ele.domElement.classList[shouldShow ? 'remove' : 'add']('hide'); + } +} diff --git a/src/components/tabs/tabs.js b/src/components/tabs/tabs.js index ab27686669..62439ce167 100644 --- a/src/components/tabs/tabs.js +++ b/src/components/tabs/tabs.js @@ -1,6 +1,7 @@ import {NgElement, Component, Template, Parent} from 'angular2/angular2'; import {History} from '../../history'; import {Ion} from '../ion'; +import {View} from 'ionic/components/view/view'; @Component({ @@ -25,7 +26,7 @@ import {Ion} from '../ion'; ` }) -export class Tabs extends View { +export class Tabs extends Ion { constructor(@NgElement() ele:NgElement) { ele.domElement.classList.add('view'); @@ -45,44 +46,3 @@ export class Tabs extends View { } } - - -@Component({ - selector: 'ion-tab', - bind: { - tabTitle: 'tab-title' - } -}) -@Template({ - inline: ` -
-
-
- -
-
-
- ` -}) -export class Tab extends View { - - constructor(@NgElement() ele:NgElement, @Parent() tabs: Tabs) { - this.ele = ele; - this.history = new History(); - - ele.domElement.classList.add('view'); - ele.domElement.classList.add('tab-view'); - - tabs.add(this); - - setTimeout(() => { - // HACK!!!!! "this" doesn't have tabTitle when not in setTimeout - console.log(this.tabTitle) - }) - - } - - show(shouldShow) { - this.ele.domElement.classList[shouldShow ? 'remove' : 'add']('hide'); - } -} diff --git a/src/components/view-group/view-group.js b/src/components/view-group/view-group.js deleted file mode 100644 index 3da5c86214..0000000000 --- a/src/components/view-group/view-group.js +++ /dev/null @@ -1,5 +0,0 @@ -import {Ion} from '../ion'; - -export class ViewGroup extends Ion { - -}