Within the UpgradePage
, I have a scenario where I want to navigate to the same page either through the side menu
or as a modal page
using push/setRoot
.
Q: The method upgradeLater()
is where I need to make a decision on whether to redirect to another page, HomePage
, or simply close it as a popup
using this.viewCtrl.dismiss();
. Is there a way to achieve this?
Note: Specifically, how can I determine if the current page
was created as a modal
or not?
upgrade.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-upgrade',
templateUrl: 'upgrade.html',
})
export class UpgradePage {
constructor(private navCtrl: NavController, private navParams: NavParams) {
}
upgradeLater() {
if("coming from side menu"){
this.navCtrl.setRoot('HomePage');
} else{
this.viewCtrl.dismiss(); //if loaded this page as modal page
}
}
}