Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. import { BrowserModule } from '@angular/platform-browser';
  2. import { NgModule, ErrorHandler } from '@angular/core';
  3. import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
  4. import { MyApp } from './app.component';
  5.  
  6. import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
  7. import { ItemDetailsPage } from '../pages/item-details/item-details';
  8. import { ListPage } from '../pages/list/list';
  9.  
  10. import { StatusBar } from '@ionic-native/status-bar';
  11. import { SplashScreen } from '@ionic-native/splash-screen';
  12.  
  13. @NgModule({
  14. declarations: [
  15. MyApp,
  16. HelloIonicPage,
  17. ItemDetailsPage,
  18. ListPage
  19. ],
  20. imports: [
  21. BrowserModule,
  22. IonicModule.forRoot(MyApp),
  23. ],
  24. bootstrap: [IonicApp],
  25. entryComponents: [
  26. MyApp,
  27. HelloIonicPage,
  28. ItemDetailsPage,
  29. ListPage
  30. ],
  31. providers: [
  32. StatusBar,
  33. SplashScreen,
  34. {provide: ErrorHandler, useClass: IonicErrorHandler}
  35. ]
  36. })
  37. export class AppModule {}
  38.  
  39. import { Component, ViewChild } from '@angular/core';
  40.  
  41. import { Platform, MenuController, Nav } from 'ionic-angular';
  42.  
  43. import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
  44. import { ListPage } from '../pages/list/list';
  45.  
  46. import { StatusBar } from '@ionic-native/status-bar';
  47. import { SplashScreen } from '@ionic-native/splash-screen';
  48.  
  49.  
  50. @Component({
  51. templateUrl: 'app.html'
  52. })
  53. export class MyApp {
  54. @ViewChild(Nav) nav: Nav;
  55.  
  56. // make HelloIonicPage the root (or first) page
  57. rootPage = HelloIonicPage;
  58. pages: Array<{title: string, component: any}>;
  59.  
  60. constructor(
  61. public platform: Platform,
  62. public menu: MenuController,
  63. public statusBar: StatusBar,
  64. public splashScreen: SplashScreen
  65. ) {
  66. this.initializeApp();
  67.  
  68. // set our app's pages
  69. this.pages = [
  70. { title: 'Hello Ionic', component: HelloIonicPage },
  71. { title: 'My First List', component: ListPage }
  72. ];
  73. }
  74.  
  75. initializeApp() {
  76. this.platform.ready().then(() => {
  77. // Okay, so the platform is ready and our plugins are available.
  78. // Here you can do any higher level native things you might need.
  79. this.statusBar.styleDefault();
  80. this.splashScreen.hide();
  81. });
  82. }
  83.  
  84. openPage(page) {
  85. // close the menu when clicking a link from the menu
  86. this.menu.close();
  87. // navigate to the new page if it is not the current page
  88. this.nav.setRoot(page.component);
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement