Experimenting with Ionic global class

This commit is contained in:
Max Lynch
2015-05-29 18:44:32 -05:00
parent ad28b64878
commit ee953359f1
3 changed files with 22 additions and 3 deletions

View File

@ -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'

View File

@ -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);
})
}

View File

@ -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;
}
}