|
@@ -1,14 +1,20 @@
|
|
|
-import { Component } from '@angular/core';
|
|
|
-import { Platform } from 'ionic-angular';
|
|
|
+import { Component, ViewChild } from '@angular/core';
|
|
|
+import { Nav, Platform } from 'ionic-angular';
|
|
|
import { StatusBar } from '@ionic-native/status-bar';
|
|
|
import { SplashScreen } from '@ionic-native/splash-screen';
|
|
|
|
|
|
import { HomePage } from '../pages/home/home';
|
|
|
+import { SettingsPage } from '../pages/settings/settings';
|
|
|
+
|
|
|
@Component({
|
|
|
templateUrl: 'app.html'
|
|
|
})
|
|
|
export class MyApp {
|
|
|
- rootPage:any = HomePage;
|
|
|
+ @ViewChild(Nav) nav: Nav;
|
|
|
+
|
|
|
+ rootPage: any = HomePage;
|
|
|
+
|
|
|
+ pages: Array<{ title: string, icon:string, component: any }>;
|
|
|
|
|
|
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
|
|
|
platform.ready().then(() => {
|
|
@@ -17,6 +23,17 @@ export class MyApp {
|
|
|
statusBar.styleDefault();
|
|
|
splashScreen.hide();
|
|
|
});
|
|
|
+
|
|
|
+ this.pages = [
|
|
|
+ { title: 'Home', icon: 'home', component: HomePage },
|
|
|
+ { title: 'Settings', icon: 'settings', component: SettingsPage }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ openPage(page) {
|
|
|
+
|
|
|
+
|
|
|
+ this.nav.setRoot(page.component);
|
|
|
}
|
|
|
}
|
|
|
|