Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Change the root page on press of back button

$
0
0

@scorpion3 wrote:

Hello Folks,

I have a scenario here, 2 profiles (Admin and Standard)

user login(set as root) > profile selection (Admin or Standard) > assume Admin selected > Admin (set as root) > other Admin pages

Now I also want to give the user an option of choosing other profile, in this case, Standard.

I am providing a Menu > My Profile > Switch Profile Page (Admin/Standard), on the profile page I have other details too. Here the user can switch to Standard ( using radio button ), and if the user presses the back button (phone) or from Navbar, I was hoping to set the rootPage to Standard.

Here is what I tried, the selectedProfile will have selected values from the radio button.

 ionViewCanLeave() {
   console.log("ionViewEntered")
       if(this.selectedProfile == 'Admin'){
           this.navCtrl.setRoot('AdminPage')
           this.navCtrl.popToRoot();
        console.log("ionViewEntered - Admin")
      } else {
        this.navCtrl.setRoot('StandardPage');
        this.navCtrl.popToRoot();
        console.log("ionViewEntered - Standard")
      }

    return true;
  }

I am getting this error,
core.es5.js:1084 ERROR Error: Uncaught (in promise): invalid link: StandardPage

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>