从着陆页打开TabsPage?

时间:2018-05-24 11:26:17

标签: ionic-framework

我正在尝试首先显示着陆,然后是标签页,但我不确定如何在 landing.ts 中指定TabsPage

landing.ts:

  startApp() {
    //window.localStorage.setItem('username', 'admin');

    this.navCtrl.setRoot('TabsPage', {}, {
      animate: true,
      direction: 'forward'
    });
  }

错误:

  

未捕获(承诺):无效链接:TabsPage

1 个答案:

答案 0 :(得分:0)

您正在尝试深层链接到您的TabsPage(.setRoot('TabsPage')

 startApp() {
    //window.localStorage.setItem('username', 'admin');

    this.navCtrl.setRoot('TabsPage', {}, {
      animate: true,
      direction: 'forward'
    });
  }

相反,请尝试

import { TabsPage } from 'wherever/it/is'

startApp() {
  // no quotes around TabsPage
  this.navCtrl.setRoot(TabsPage);
}