【问题标题】:Side Menu and the page does not responds after setting root page again Ionic 2 Beta 11侧边菜单和再次设置根页面后页面没有响应 Ionic 2 Beta 11
【发布时间】:2017-02-21 13:47:24
【问题描述】:

您好,我正在使用 Ionic 2 Beta 11。 登录后我在登录页面上我在登录后将页面设置为根页面,页面显示和菜单图标也显示,但是当我点击页面屏幕上的页面按钮和菜单图标时,页面没有响应,而且菜单不起作用。 我尝试了这些解决方案,但这些都不起作用

this.navCtrl.setRoot(AppointmentsPage);

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

这是我的代码。

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{
  }

}

请帮我解决这个问题

【问题讨论】:

    标签: angular typescript ionic-framework ionic2 ionic-view


    【解决方案1】:

    如果有人遇到这个问题,我想我已经在这个 cenary 中找到了主要问题。当您从“模态”或“弹出框”推送时会出现问题,因此会出现导航问题。要以正确的方式执行此操作,请从调用 popover 或 modal 的页面执行 pushsetRoot。这可以通过“onDidDismiss”函数轻松完成:

    //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)
        }
    });
    

    希望对某人有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-16
      • 2016-08-29
      • 2016-08-21
      • 1970-01-01
      • 2017-11-09
      • 2017-08-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多