Created
March 22, 2017 15:22
-
-
Save chrisgriffith/0fc423f08a78a681c3cd7185b1e4f458 to your computer and use it in GitHub Desktop.
IONIC SPLIT PANE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, ViewChild } from '@angular/core'; | |
import { Events, MenuController, Nav, Platform } from 'ionic-angular'; | |
import { StatusBar, Splashscreen } from 'ionic-native'; | |
import { MainPage } from '../pages/main/main'; | |
import { MercuryPage } from '../pages/mercury/mercury'; | |
import { GeminiPage } from '../pages/gemini/gemini'; | |
import { ApolloPage } from '../pages/apollo/apollo'; | |
import { AstpPage } from '../pages/astp/astp'; | |
import { SkylabPage } from '../pages/skylab/skylab'; | |
import { ShuttlePage } from '../pages/shuttle/shuttle'; | |
import { OrionPage } from '../pages/orion/orion'; | |
@Component({ | |
templateUrl: 'app.html' | |
}) | |
export class MyApp { | |
@ViewChild(Nav) nav: Nav; | |
rootPage: any; | |
projects: Array<any> = []; | |
title: String = 'Projects'; | |
menuToggleState: Boolean = false; | |
constructor(public menuCtrl: MenuController, public platform: Platform, public events: Events) { | |
this.rootPage = MainPage; | |
this.projects = [ | |
{ name: 'Mercury', details: MercuryPage }, | |
{ name: 'Gemini', details: GeminiPage }, | |
{ name: 'Apollo', details: ApolloPage }, | |
{ name: 'Skylab', details: SkylabPage }, | |
{ name: 'ASTP', details: AstpPage }, | |
{ name: 'Space Shuttle', details: ShuttlePage }, | |
{ name: 'Orion', details: OrionPage } | |
] | |
platform.ready().then(() => { | |
// Okay, so the platform is ready and our plugins are available. | |
// Here you can do any higher level native things you might need. | |
StatusBar.styleDefault(); | |
Splashscreen.hide(); | |
this.platform.width() < 768 ? this.menuToggleState = true : this.menuToggleState = false; | |
}); | |
} | |
projectSelected(theProject) { | |
this.nav.setRoot(theProject.details); | |
this.menuCtrl.close(); | |
} | |
updateTitles() { | |
this.platform.width() < 768 ? this.menuToggleState = true : this.menuToggleState = false; | |
this.events.publish('title:updated', { menuState: this.menuToggleState }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment