|
1 | | -import { Component } from '@angular/core'; |
2 | | -import { Platform } from 'ionic-angular'; |
| 1 | +import { Component, ViewChild } from '@angular/core'; |
| 2 | +import { Nav, Platform } from 'ionic-angular'; |
3 | 3 | import { StatusBar } from '@ionic-native/status-bar'; |
4 | 4 | import { SplashScreen } from '@ionic-native/splash-screen'; |
5 | 5 |
|
6 | 6 | import { HomePage } from '../pages/home/home'; |
| 7 | +import { LoginPage } from '../pages/login/login'; |
| 8 | +import { RegisterPage } from '../pages/register/register'; |
| 9 | +import { WizardPage } from '../pages/wizard/wizard'; |
| 10 | +import { DashboardPage } from '../pages/dashboard/dashboard'; |
| 11 | +import { ProfilePage } from '../pages/profile/profile'; |
| 12 | +import { TransitionPage } from '../pages/transition/transition'; |
| 13 | +import { AssessmentPage } from '../pages/assessment/assessment'; |
| 14 | +import { TimelinePage } from '../pages/timeline/timeline'; |
| 15 | + |
7 | 16 | @Component({ |
8 | 17 | templateUrl: 'app.html' |
9 | 18 | }) |
10 | 19 | export class MyApp { |
11 | | - rootPage:any = HomePage; |
| 20 | + @ViewChild(Nav) nav: Nav; |
| 21 | + |
| 22 | + rootPage: any = HomePage; |
| 23 | + |
| 24 | + pages: Array<{title: string, component: any}>; |
| 25 | + |
| 26 | + constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) { |
| 27 | + this.initializeApp(); |
| 28 | + |
| 29 | + // used for an example of ngFor and navigation |
| 30 | + this.pages = [ |
| 31 | + { title: 'Home', component: HomePage }, |
| 32 | + { title: 'Login', component: LoginPage }, |
| 33 | + { title: 'Register', component: RegisterPage }, |
| 34 | + { title: 'Wizard', component: WizardPage }, |
| 35 | + { title: 'Dashboard', component: DashboardPage }, |
| 36 | + { title: 'Profile', component: ProfilePage }, |
| 37 | + { title: 'Transition', component: TransitionPage }, |
| 38 | + { title: 'Assessment', component: AssessmentPage }, |
| 39 | + { title: 'Timeline', component: TimelinePage } |
| 40 | + ]; |
12 | 41 |
|
13 | | - constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { |
14 | | - platform.ready().then(() => { |
| 42 | + } |
| 43 | + |
| 44 | + initializeApp() { |
| 45 | + this.platform.ready().then(() => { |
15 | 46 | // Okay, so the platform is ready and our plugins are available. |
16 | 47 | // Here you can do any higher level native things you might need. |
17 | | - statusBar.styleDefault(); |
18 | | - splashScreen.hide(); |
| 48 | + this.statusBar.styleDefault(); |
| 49 | + this.splashScreen.hide(); |
19 | 50 | }); |
20 | 51 | } |
21 | | -} |
22 | 52 |
|
| 53 | + openPage(page) { |
| 54 | + // Reset the content nav to have just this page |
| 55 | + // we wouldn't want the back button to show in this scenario |
| 56 | + this.nav.setRoot(page.component); |
| 57 | + } |
| 58 | +} |
0 commit comments