我有一个代码:
import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavController, Nav, App, Tabs} from 'ionic-angular';
@Component({
templateUrl: 'tabs.html'
})
export class TabsPage {
tab1Root = HomePage;
tab2Root = AboutPage;
tab3Root = ContactPage;
app: App;
constructor(app:App, nav: Nav) {
this.app = app;
console.log('=======================');
this.app.viewDidLoad.subscribe((view) => {
console.log(view.instance.constructor.name);
});
}
}
起初我得到:
=======================
TabsPage
HomePage
当我浏览其他标签时:
AboutPage
和其他选项卡:
ContactPage
但现在我回到相同的标签上,事件停止工作,为什么?请帮忙
Angular在'@ angular / router'中有类似的模块;而且一切都很好,例如:
router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == '/notes') {
}
});
儿童航线的导航工作总是如此 . 如何使工作离子这样?
1 回答
你可以这样做:
html的
.TS
在这里你可以看到所有methods and properties .