import { Component , NgModule , ViewChild } from '@angular/core' ; import { BrowserModule } from '@angular/platform-browser' ; import { AlertController , IonicApp , IonicModule , Nav } from '../../../..' ; @ Component ( { templateUrl : 'page1.html' } ) export class Page1 { } @ Component ( { templateUrl : 'main.html' } ) export class AppComponent { @ ViewChild ( Nav ) nav : Nav ; rootView = Page1 ; constructor ( public alertCtrl ) { } openPage ( menu , page ) { menu . close ( ) ; this . nav . setRoot ( page . component ) ; } showAlert ( ) { let alert = this . alertCtrl . create ( { title : 'Alert example' , buttons : [ 'Ok' ] } ) ; alert . present ( ) ; } } @ NgModule ( { declarations : [ AppComponent , Page1 ] , imports : [ BrowserModule , IonicModule . forRoot ( AppComponent ) ] , bootstrap : [ IonicApp ] , entryComponents : [ AppComponent , Page1 ] } ) export class AppModule { }