app.component.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Component, ViewChild } from '@angular/core';
  2. import { Nav, Platform } from 'ionic-angular';
  3. import { StatusBar } from '@ionic-native/status-bar';
  4. import { SplashScreen } from '@ionic-native/splash-screen';
  5. import { HomePage } from '../pages/home/home';
  6. import { SettingsPage } from '../pages/settings/settings';
  7. @Component({
  8. templateUrl: 'app.html'
  9. })
  10. export class MyApp {
  11. @ViewChild(Nav) nav: Nav;
  12. rootPage: any = HomePage;
  13. pages: Array<{ title: string, icon:string, component: any }>;
  14. constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
  15. platform.ready().then(() => {
  16. // Okay, so the platform is ready and our plugins are available.
  17. // Here you can do any higher level native things you might need.
  18. statusBar.styleDefault();
  19. splashScreen.hide();
  20. });
  21. this.pages = [
  22. { title: 'Home', icon: 'home', component: HomePage },
  23. { title: 'Settings', icon: 'settings', component: SettingsPage }
  24. ];
  25. }
  26. openPage(page) {
  27. // Reset the content nav to have just this page
  28. // we wouldn't want the back button to show in this scenario
  29. this.nav.setRoot(page.component);
  30. }
  31. }