0
我在離子2 MyApp類,我想顯示一個屏幕3秒,然後切換到另一個。 我得到一個this.nav.parent爲空錯誤。 我正在嘗試兩種類型的定時器,但都沒有工作。 我正在使用標籤,並希望它順便去到第一個標籤頁。離子2計時器導致應用程序類崩潰
gotoFirstPage()
{
//these two lines work fine
//this.nav.setRoot(TabsPage);
//this.nav.parent.select(1); //this.nav.parent is not null here
setTimeout((function()
{
this.nav.setRoot(TabsPage);
this.nav.parent.select(1); //this.nav.parent is null
}.bind(this)),3000);
let timer = Observable.timer(3000, 86400000);
timer.subscribe(t => {
this.nav.setRoot(TabsPage);
this.nav.parent.select(1); //this.nav.parent is null
});
}