src/app/app.component.ts
templateUrl | app.html |
Properties |
Methods |
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, modelLoader: ModelLoaderProvider)
|
||||||||||||||||||||
Defined in src/app/app.component.ts:55
|
||||||||||||||||||||
Creates the status bar and requests the model to be loaded as soon as the platform is ready
Parameters :
|
openPage | ||||||
openPage(page: )
|
||||||
Defined in src/app/app.component.ts:82
|
||||||
Handles which page is opened depending on which tab is pressed
Parameters :
Returns :
void
|
nav |
nav:
|
Type : Nav
|
Decorators : ViewChild
|
Defined in src/app/app.component.ts:46
|
pages |
pages:
|
Type : Array<literal type>
|
Defined in src/app/app.component.ts:55
|
Array of page objects which are in the form (title, component) |
rootPage |
rootPage:
|
Type : any
|
Default value : TabsPage
|
Defined in src/app/app.component.ts:51
|
The root page should be the page with the Tabs |
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';
// import { Camera, CameraOptions } from '@ionic-native/camera';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
// import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
// import { UtilitiesPage } from '../pages/utilities/utilities';
import { ImagerecPage } from '../pages/imagerec/imagerec';
import { ModelLoaderProvider } from '../providers/model-loader/model-loader';
/**
* @ignore
*/
export interface PageInterface {
title: string;
pageName: string;
tabComponent?: any;
index?: number;
icon: string;
}
@Component({
templateUrl: 'app.html'
})
export class MyApp {
@ViewChild(Nav) nav: Nav;
/**
* The root page should be the page with the Tabs
*/
rootPage: any = TabsPage;
/**
* Array of page objects which are in the form (title, component)
*/
pages: Array<{ title: string, component: any }>;
/**
* Creates the status bar and requests the model to be loaded as soon as the platform is ready
* @param platform Default Ionic platofrm
* @param statusBar Cordova plugin for a statusbar
* @param splashScreen Cordova plugin for the splash screen
* @param modelLoader Provider that handles model loading and image classification
*/
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, modelLoader: ModelLoaderProvider) {
platform.ready().then(() => {
statusBar.styleDefault();
console.log('App: Calling provider function - loadModel');
modelLoader.loadModel();
});
this.pages = [
{ title: 'Custom image recognition', component: ImagerecPage },
{ title: 'Need Help?', component: ContactPage },
{ title: 'About Us', component: AboutPage }
];
}
/**
* Handles which page is opened depending on which tab is pressed
* @param page Determines which page is opened
*/
openPage(page) {
this.nav.setRoot(page.component);
}
}
<!-- /**
* File Name: app.html
* Version Number: v1.1
* Author: Orisha Orrie
* Project Name: Ninshiki
* Organization: Software Sharks
* User Manual: Refer to https://github.com/OrishaOrrie/SoftwareSharks/blob/master/Documentation/User%20Manual.pdf
* Update History:
* ------------------------------------------
* Date Author Description
* 20/07/2018 Orisha Created component
* ------------------------------------------
* Functional Description:
* Main app component interface. Pages created here.
*/ -->
<ion-navbar *navbar>
<ion-title> Page Title </ion-title>
</ion-navbar>
<!-- <ion-menu> -->
<!-- <ion-content>
<ion-list>
<button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
<!-- <ion-icon item-start [name]="p.icon" [color]="isActive(p)"></ion-icon> -->
<!-- <ion-icon item-start [color]="isActive(p)"></ion-icon> -->
<!-- {{p.title}} -->
<!-- </button> -->
<!-- </ion-list> -->
<!-- </ion-content> -->
<!-- </ion-menu> -->
<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>