2

Hi i am using Ionic 2 Beta 11. I am on login page after login i am setting a page as a root page after login the page shows and menu icon shows also but when i click on page button and menu icon on the screen of the page then page does not responds and also the menu does not work to. i tried these solutions but none of these work

this.navCtrl.setRoot(AppointmentsPage);

and

 this.app.getRootNav().setRoot(AppointmentsPage)

Here is my code.

onLogin(form) {
      this.submitted = true;
if (form.valid) {
    this.networkservice.showLoading();
    var data = this.userData.login(this.login.email,this.login.password);
    console.log(data);
    data.subscribe(res => {
          if(res.length == 0  ) {
            this.login.isVaild = false;
            this.networkservice.hideLoading();  
          }else{
            this.userData.setDoctor(res[0]);
            this.hideLoading();
            this.navCtrl.setRoot(AppointmentsPage);


          }

        });

  }else{
  }

}

Kindly help me on this issue

1 Answers1

0

If anyone face this problem, I think I have found the main issue in this cenary. The problem occurs when you are pushing from a "modal" or "popover" and so it happens the navigation problem. To do this the right way, execute the push or setRoot 'from the page that calls popover or modal instead'. This can be done easily with the 'onDidDismiss' function:

//Page which calls popover:
popover.create();

//Page popover: Dismiss existing popover (you may also pass a parameter)
popover.dismiss(myParameter);

//Page which calls popover: Veriry if popover was removed
popover.onDidDismiss(data => {
    if(data == "something")
    {
        //Navigate to new page
        this.nav.push(newPage)
    }
});

Hope it helps someone!

Lud Akell
  • 151
  • 1
  • 3