app.component.ts 1.3 KB

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