Skip to content

Instantly share code, notes, and snippets.

@mhartington
Created March 1, 2016 19:24
Show Gist options
  • Save mhartington/3372d05d8a1942a3a6be to your computer and use it in GitHub Desktop.
Save mhartington/3372d05d8a1942a3a6be to your computer and use it in GitHub Desktop.
import {App, IonicApp, Platform} from 'ionic-framework/ionic';
import {GettingStartedPage} from './pages/getting-started/getting-started';
import {ListPage} from './pages/list/list';
@App({
templateUrl: 'build/app.html',
config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
class MyApp {
rootPage;
value = true;
pages: Array<{ title: string, component: any }>
constructor(private app: IonicApp, private platform: Platform) {
if (this.value) {
this.rootPage = GettingStartedPage
} else {
this.rootPage = ListPage
}
this.initializeApp();
this.pages = [
{ title: 'Getting Started', component: GettingStartedPage },
{ title: 'List', component: ListPage }
];
}
initializeApp() {
this.platform.ready().then(() => {
});
}
openPage(page) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
let nav = this.app.getComponent('nav');
nav.setRoot(page.component);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment