Ionic 2在导航时破坏了之前的页面

时间:2017-10-23 13:13:52

标签: ionic-framework navigation

我正在创建一个在IOS环境中运行的Ionic 2应用程序。我的应用程序具有资源丰富的页面,并且当使用离子NavController在页面之间导航时,应用程序会卡在导航的后半部分。经过分析,我意识到这是因为NavController将先前页面堆叠在其内存中。在Ionic中向前导航时是否存在破坏先前页面的机制。

1 个答案:

答案 0 :(得分:0)

this.navCtrl.push(newPage).then(() => {
  let index = this.navCtrl.length;
  this.navCtrl.remove(index - 2);
  // index is your stack size
  // index - 1 is your newly pushed page
  // index - 2 is the page previous to it
});