author Damien Dell'Amico <damien.dellamico@gmail.com>
 *  copyright license import { Component , ViewChild } from '@angular/core' ; import { Platform , Nav } from 'ionic-angular' ; import { StatusBar , Splashscreen } from 'ionic-native' ; import { HomePage } from '../pages/home/home' ; import { AboutPage } from '../pages/about/about' ; import { RideListPage } from '../pages/ride-list/ride-list' ; export interface PageInterface { title : string ; component : any ; icon : string ; logsOut ? : boolean ; index ? : number ; tabComponent ? : any ; } @ Component ( { templateUrl : 'app.template.html' , } ) export class TaxiApp { appPages : PageInterface [ ] = [ { title : 'Map' , component : HomePage , index : 1 , icon : 'map' } , { title : 'Taxi rides' , component : RideListPage , index : 2 , icon : 'car' } , { title : 'About' , component : AboutPage , index : 3 , icon : 'information-circle' } , ] ; rootPage : any = HomePage ; @ ViewChild ( Nav ) private nav : Nav ; constructor ( private platform ) { platform . ready ( ) . then ( ( ) => { StatusBar . styleDefault ( ) ; Splashscreen . hide ( ) ; if ( ( < any > window ) . cordova && ( < any > window ) . cordova . InAppBrowser ) { window . open = ( < any > window ) . cordova . InAppBrowser . open ; } } ) ; } openPage ( page ) { if ( page . index ) { this . nav . setRoot ( page . component , { tabIndex : page . index } ) ; } else { this . nav . setRoot ( page . component ) . catch ( ( ) => { console . log ( "Didn't set nav root" ) ; } ) ; } } }