回来时未调用ngOnInit [英] ngOnInit not called when coming back

查看:86
本文介绍了回来时未调用ngOnInit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当我回到已经实例化的页面时,没有调用ngOnInit()方法.我必须使用其他任何方法吗?我需要一种在他访问特定页面时每次都会调用的方法.

I noticed that the ngOnInit() method gets not called when I come back to the page which is already instanced. I have to use any other method for this? I need a method which is called everytime when he is visiting the specific page.

编辑 已测试onPageWillEnter(),但在Ionic 2中未触发

EDIT Tested already onPageWillEnter() but it gets not fired in Ionic 2

推荐答案

检查生命周期事件部分.

您可以使用ionic 2生命周期挂钩

You can use ionic 2 lifecycle hook

ionViewWillEnter(){
 //your methods
}

这篇关于回来时未调用ngOnInit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆