【发布时间】:2021-10-15 18:11:57
【问题描述】:
我的组件同时具有getCurrentNavigation 和router.navigate
我已经从here实现了getCurrentNavigation
现在页面有
constructor() {
if (router.getCurrentNavigation().extras.state) {
this.levelId = router.getCurrentNavigation().extras.state.arcadeSelectedGame;
}
}
并导航到另一个页面
const navigationExtras: NavigationExtras = {
state: {
dummyObject,
gameplay_log_data,
arcadeLevelData: this.arcadeLevelData
}
};
this.router.navigate(['ad-page'], navigationExtras)
现在我已经应用了 here 的解决方案,然后导航工作,但随后 router.getCurrentNavigation().extras.state 停止工作
【问题讨论】:
标签: angular ionic-framework karma-jasmine angular-test