直到刷新页面,我的根页面才被设置

时间:2018-10-31 14:21:37

标签: angular ionic-framework lazy-loading

在刷新页面之前,我的系统未设置适当的setRoot。我正在使用延迟加载进行导航。因此流程为rootpage = login-> dashboard。问题是刷新页面后程序可以完美运行。 我是离子技术的新手,所以不确定自己做错了什么。

LOGIN PAGE
if(p.type == "Student"){
                  this.navCtrl.setRoot("DashboardStudentPage");
                }
                else if(p.type =="Mentor"){
                  this.navCtrl.setRoot("DashboardMentorPage");

export class DashboardStudentPage {
  @ViewChild(Nav) nav: Nav;
  pages: Array<{title:string,component:string,openTab?:any}>;
  rootPage = 'HomePage';
  constructor(public navCtrl: NavController, public navParams: NavParams,public afAuth: AngularFireAuth,) {
   
    this.pages = [
      {title:'Profile',component:'HomePage'},
      {title:'Progress',component:'ProgressPage'},
      {title:'Learning',component:'LearningPage'},
      {title:'Exercises',component:'ExercisesPage'},
      {title:'Tests',component:'TestsPage'},
      {title:'Groups',component:'GroupPage'},

    ];
 
  }

  openPage(page){
    this.nav.setRoot(page.component)
  }

0 个答案:

没有答案