Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule, ErrorHandler } from '@angular/core';
- import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
- import { MyApp } from './app.component';
- import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
- import { ItemDetailsPage } from '../pages/item-details/item-details';
- import { ListPage } from '../pages/list/list';
- import { StatusBar } from '@ionic-native/status-bar';
- import { SplashScreen } from '@ionic-native/splash-screen';
- @NgModule({
- declarations: [
- MyApp,
- HelloIonicPage,
- ItemDetailsPage,
- ListPage
- ],
- imports: [
- BrowserModule,
- IonicModule.forRoot(MyApp),
- ],
- bootstrap: [IonicApp],
- entryComponents: [
- MyApp,
- HelloIonicPage,
- ItemDetailsPage,
- ListPage
- ],
- providers: [
- StatusBar,
- SplashScreen,
- {provide: ErrorHandler, useClass: IonicErrorHandler}
- ]
- })
- export class AppModule {}
- import { Component, ViewChild } from '@angular/core';
- import { Platform, MenuController, Nav } from 'ionic-angular';
- import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
- import { ListPage } from '../pages/list/list';
- import { StatusBar } from '@ionic-native/status-bar';
- import { SplashScreen } from '@ionic-native/splash-screen';
- @Component({
- templateUrl: 'app.html'
- })
- export class MyApp {
- @ViewChild(Nav) nav: Nav;
- // make HelloIonicPage the root (or first) page
- rootPage = HelloIonicPage;
- pages: Array<{title: string, component: any}>;
- constructor(
- public platform: Platform,
- public menu: MenuController,
- public statusBar: StatusBar,
- public splashScreen: SplashScreen
- ) {
- this.initializeApp();
- // set our app's pages
- this.pages = [
- { title: 'Hello Ionic', component: HelloIonicPage },
- { title: 'My First List', component: ListPage }
- ];
- }
- initializeApp() {
- this.platform.ready().then(() => {
- // Okay, so the platform is ready and our plugins are available.
- // Here you can do any higher level native things you might need.
- this.statusBar.styleDefault();
- this.splashScreen.hide();
- });
- }
- openPage(page) {
- // close the menu when clicking a link from the menu
- this.menu.close();
- // navigate to the new page if it is not the current page
- this.nav.setRoot(page.component);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement