mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
Experimenting with Ionic global class
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
// DON'T reference this file in the source. Only in demos.
|
// 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/action-menu/action-menu'
|
||||||
// export * from 'ionic/components/alert/alert'
|
// export * from 'ionic/components/alert/alert'
|
||||||
export * from 'ionic/components/aside/aside'
|
export * from 'ionic/components/aside/aside'
|
||||||
|
@ -2,7 +2,7 @@ import {bootstrap} from 'angular2/angular2'
|
|||||||
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
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';
|
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',
|
templateUrl: 'main.html',
|
||||||
directives: [Button, Content]
|
directives: [Button, Content]
|
||||||
})
|
})
|
||||||
class IonicApp {
|
class IonicApp extends Ionic {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
super();
|
||||||
console.log('IonicApp Start')
|
console.log('IonicApp Start')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,5 +26,7 @@ class IonicApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
bootstrap(IonicApp);
|
bootstrap(IonicApp).then((appRef) => {
|
||||||
|
appRef.hostComponent.setAppRef(appRef);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
15
ionic/components/app/app.js
Normal file
15
ionic/components/app/app.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user