app.component.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { Component, ViewChild } from '@angular/core';
  2. import { Nav, Platform } from 'ionic-angular';
  3. import { StatusBar } from 'ionic-native';
  4. import { Login } from '../pages/login/login';
  5. import { Page1 } from '../pages/page1/page1';
  6. import { Page2 } from '../pages/page2/page2';
  7. @Component({
  8. templateUrl: 'app.html'
  9. })
  10. export class MyApp {
  11. @ViewChild(Nav) nav: Nav;
  12. rootPage: any = Login;
  13. pages: Array<{title: string, component: any}>;
  14. constructor(public platform: Platform) {
  15. this.initializeApp();
  16. // used for an example of ngFor and navigation
  17. this.pages = [
  18. { title: 'Page One', component: Page1 },
  19. { title: 'Page Two', component: Page2 }
  20. ];
  21. }
  22. initializeApp() {
  23. this.platform.ready().then(() => {
  24. // Okay, so the platform is ready and our plugins are available.
  25. // Here you can do any higher level native things you might need.
  26. StatusBar.styleDefault();
  27. });
  28. }
  29. openPage(page) {
  30. // Reset the content nav to have just this page
  31. // we wouldn't want the back button to show in this scenario
  32. this.nav.setRoot(page.component);
  33. }
  34. }