mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
import {bootstrap, QueryList, ElementRef, NgFor, NgIf} from 'angular2/angular2'
|
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
|
import {Descendant} from 'angular2/src/core/annotations_impl/visibility';
|
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
|
import {Query} from 'angular2/src/core/annotations_impl/di';
|
|
|
|
console.log(Query, QueryList);
|
|
|
|
import {Ionic, Nav, Toolbar, ViewContainer, Aside, List, Item, Content, Button} from 'ionic/ionic';
|
|
|
|
import {ButtonPage} from './pages/button'
|
|
import {ActionMenuPage} from './pages/action-menu'
|
|
import {ModalPage} from './pages/modal'
|
|
import {ListPage} from './pages/list'
|
|
|
|
@Component({
|
|
selector: 'ion-app',
|
|
})
|
|
@View({
|
|
templateUrl: 'main.html',
|
|
directives: [Nav, NgFor, NgIf, Aside, List, ViewContainer, Toolbar, Item, Content, Button]
|
|
})
|
|
export class IonicApp {
|
|
constructor(elementRef: ElementRef) {//, @Query(Aside) nav: QueryList) {//, @Descendant() aside: Aside) {
|
|
Ionic.setRootElementRef(elementRef);
|
|
|
|
this.components = [
|
|
{ title: 'Buttons', component: ButtonPage },
|
|
{ title: 'Lists', component: ListPage },
|
|
{ title: 'Action Menu', component: ActionMenuPage },
|
|
{ title: 'Modal', component: ModalPage }
|
|
];
|
|
|
|
this.firstPage = ButtonPage
|
|
}
|
|
|
|
openPage(aside, component) {
|
|
aside.close();
|
|
window.nav.clear().then(() => {
|
|
window.nav.push(component.component, {}, {
|
|
animate: false
|
|
});
|
|
})
|
|
}
|
|
}
|
|
|
|
export function main() {
|
|
bootstrap(IonicApp).then((appRef) => {
|
|
Ionic.setAppRef(appRef);
|
|
})
|
|
}
|