import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams ,ModalController} from 'ionic-angular'; import { AngularFireDatabase } from 'angularfire2/database'; import { HomePage } from '../../pages/home/home'; import { RemindersPage } from '../reminders/reminders'; import { TimetablePage } from "../timetable/timetable"; import {DeadlinesPage} from "../deadlines/deadlines"; import {AttandancePage} from "../attandance/attandance"; import {StudentroomPage} from "../studentroom/studentroom"; import { LocationPage } from "../../pages/location/location"; /** * Generated class for the MenuPage page. * * See https://ionicframework.com/docs/components/#navigation for more info on * Ionic pages and navigation. */ @IonicPage() @Component({ selector: 'page-menu', templateUrl: 'menu.html', }) export class MenuPage { userloginInfo:any; cursename:any; userId:any; userName:any; constructor(private modal:ModalController, public navCtrl: NavController, public navParams: NavParams,private firebasedata:AngularFireDatabase) { this.userId = this.navParams.get('userId'); if(this.userId) { this.getUserCourseName(); } } getUserCourseName() { this.firebasedata.object('register/' + this.userId).valueChanges().subscribe(resp=>{ this.userloginInfo = resp; this.cursename = this.userloginInfo.course; this.userName = this.userloginInfo.firstName; console.log(this.userName); }); } ionViewDidLoad() { console.log('ionViewDidLoad MenuPage'); } ulogout() { this.navCtrl.setRoot(HomePage); } reminders() { this.navCtrl.setRoot(RemindersPage); let modal = this.modal.create(RemindersPage); modal.present(); } gotimetable() { let modal = this.modal.create(TimetablePage,{courseName:this.cursename}); modal.present(); } godeadlines() { this.navCtrl.setRoot(DeadlinesPage); let modal = this.modal.create(DeadlinesPage,{courseName:this.cursename}); modal.present(); } goattendance() { let modal = this.modal.create(AttandancePage); modal.present(); } goroom() { let modal = this.modal.create(StudentroomPage,{userid:this.userId,username:this.userName}); modal.present(); } goloco(){ this.navCtrl.setRoot(LocationPage); } }