Ionic2 ngOnInIt on导航pop
我有两页:视频页和练习列表页。我在VideoPage中,当我执行Ionic2 ngOnInIt on导航pop,ionic2,Ionic2,我有两页:视频页和练习列表页。我在VideoPage中,当我执行this.navCtrl.pop()时,我返回到ExerciseListPage 当我回到ExerciseListPage页面时,我想启动该页面上的ngOnInIt()方法(因为我在那里进行了一些初始化,并且从视频页面更改的值现在需要反映在ExerciseListPage上) 我尝试了以下内容:在我的视频页面中: this.events.publish('reloadList'); this.navCtrl.pop(); 和在E
this.navCtrl.pop()
时,我返回到ExerciseListPage
当我回到ExerciseListPage页面时,我想启动该页面上的ngOnInIt()
方法(因为我在那里进行了一些初始化,并且从视频页面更改的值现在需要反映在ExerciseListPage上)
我尝试了以下内容:在我的视频页面中:
this.events.publish('reloadList');
this.navCtrl.pop();
和在ExerciseListPage控制器中:
this.events.subscribe('reloadList',() => {
this.navCtrl.pop();
this.navCtrl.push(ExerciseListPage);
});
这不起作用。我该如何解决这个问题呢?其实很简单,我只是再次按如下方式启动了ngOnInIt:
this.events.subscribe('reloadList',() => {
this.ngOnInit();
});