From ee953359f13e069ae2e46a6e79f5a97976ec9b74 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Fri, 29 May 2015 18:44:32 -0500 Subject: [PATCH] Experimenting with Ionic global class --- ionic/components.js | 1 + ionic/components/action-menu/test/basic/index.js | 9 ++++++--- ionic/components/app/app.js | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 ionic/components/app/app.js diff --git a/ionic/components.js b/ionic/components.js index c2a97e6789..e3a5d5851b 100644 --- a/ionic/components.js +++ b/ionic/components.js @@ -1,4 +1,5 @@ // DON'T reference this file in the source. Only in demos. +export * from 'ionic/components/app/app' export * from 'ionic/components/action-menu/action-menu' // export * from 'ionic/components/alert/alert' export * from 'ionic/components/aside/aside' diff --git a/ionic/components/action-menu/test/basic/index.js b/ionic/components/action-menu/test/basic/index.js index 0e115129d1..43d376a64e 100644 --- a/ionic/components/action-menu/test/basic/index.js +++ b/ionic/components/action-menu/test/basic/index.js @@ -2,7 +2,7 @@ import {bootstrap} from 'angular2/angular2' import {Component} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; -import {Button, Content} from 'ionic/ionic'; +import {Ionic, Button, Content} from 'ionic/ionic'; import {ActionMenu} from 'ionic/components/action-menu/action-menu'; @@ -11,8 +11,9 @@ import {ActionMenu} from 'ionic/components/action-menu/action-menu'; templateUrl: 'main.html', directives: [Button, Content] }) -class IonicApp { +class IonicApp extends Ionic { constructor() { + super(); console.log('IonicApp Start') } @@ -25,5 +26,7 @@ class IonicApp { } export function main() { - bootstrap(IonicApp); + bootstrap(IonicApp).then((appRef) => { + appRef.hostComponent.setAppRef(appRef); + }) } diff --git a/ionic/components/app/app.js b/ionic/components/app/app.js new file mode 100644 index 0000000000..676b3c1049 --- /dev/null +++ b/ionic/components/app/app.js @@ -0,0 +1,15 @@ +import {ApplicationRef} from 'angular2/angular2'; + +export class Ionic { + constructor() { + + } + + setAppRef(appRef: ApplicationRef) { + this.appRef = appRef; + console.log('Got app ref', appRef); + } + getAppRef() { + return this.appRef; + } +}