econocart/src/app/app.component.ts

51 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Component, ViewChild } from '@angular/core';
import { Nav, Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
2017-04-30 21:13:47 +00:00
2017-05-21 00:16:17 +00:00
import { PageInicio } from '../pages/inicio/main';
@Component({
2017-05-07 01:52:52 +00:00
templateUrl: 'app.html'
})
export class MyApp {
2017-05-07 01:52:52 +00:00
@ViewChild(Nav) nav: Nav;
2017-05-21 00:16:17 +00:00
rootPage: any = PageInicio;
2017-05-07 01:52:52 +00:00
pages: Array<{ title: string, component: any }>;
2017-05-21 00:16:17 +00:00
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
2017-05-07 01:52:52 +00:00
this.initializeApp();
// used for an example of ngFor and navigation
this.pages = [
2017-05-21 00:16:17 +00:00
/*
2017-05-07 01:52:52 +00:00
{ title: 'Lista de Itens', component: ListItemListPage },
{ title: 'Supermercados', component: MarketListPage },
{ title: 'Produtos', component: ProductListPage },
{ title: 'Unidades', component: UnitListPage }
2017-05-21 00:16:17 +00:00
*/
2017-05-07 01:52:52 +00:00
];
}
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) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
this.nav.setRoot(page.component);
}
btnOpenHome(){
2017-05-21 00:16:17 +00:00
this.openPage({component:PageInicio})
2017-05-07 01:52:52 +00:00
}
}