File

src/app/app.component.ts

Metadata

templateUrl app.html

Index

Properties
Methods

Constructor

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, modelLoader: ModelLoaderProvider)

Creates the status bar and requests the model to be loaded as soon as the platform is ready

Parameters :
Name Type Optional Description
platform Platform No

Default Ionic platofrm

statusBar StatusBar No

Cordova plugin for a statusbar

splashScreen SplashScreen No

Cordova plugin for the splash screen

modelLoader ModelLoaderProvider No

Provider that handles model loading and image classification

Methods

openPage
openPage(page: )

Handles which page is opened depending on which tab is pressed

Parameters :
Name Optional Description
page No

Determines which page is opened

Returns : void

Properties

nav
nav: Nav
Type : Nav
Decorators : ViewChild
pages
pages: Array<literal type>
Type : Array<literal type>

Array of page objects which are in the form (title, component)

rootPage
rootPage: any
Type : any
Default value : TabsPage

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>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""