3
我正在使用NavController http://ionicframework.com/docs/v2/api/components/nav/NavController/和我改变页面,我需要知道何时加载新页面,是否有任何事件?加载页面内容事件(Ionic 2)?
我正在使用NavController http://ionicframework.com/docs/v2/api/components/nav/NavController/和我改变页面,我需要知道何时加载新页面,是否有任何事件?加载页面内容事件(Ionic 2)?
当然,您可以利用Ionic2中的生命周期事件。
例子,你可以找到更多信息here:
ionViewDidLoad() {
console.log("I'm alive!");
}
ionViewWillLeave() {
console.log("Looks like I'm about to leave :(");
}
谁使用angular2,可以调用ngAfterViewInit():
ngAfterViewInit() {
// this.yourMethod
}
谢谢你,我该如何使用呢?像onPageLoaded(){console.log('页面加载')}? – Ignat
你想实现什么? –
是的,谢谢。 – Ignat