Стас ....
А как в коде получить router name , мне надо для того чтобы при нажатии кнопки назад выйти из приложения если я на главной странице иначе перейти на главную?
app.components.ts back button event function только логин страница работает добавить сами условия как хотите
backButtonEvent() {
this.platform.backButton.subscribe(async () => {
// close side menua
try {
const element = await this.menu.getOpen()
if (element) {
this.menu.close()
return
}
} catch (error) {
}
this.routerOutlets.forEach((outlet: IonRouterOutlet) => {
if (this.router.url == '/login') {
if (new Date().getTime() - this.lastTimeBackPress < this.timePeriodToExit) {
navigator['app'].exitApp()
} else {
let toast = this.toastCtrl.create({
message: "Click to exit the application!",
duration: 2000,
position: 'bottom'
})
toast.then(toast => toast.present())
this.lastTimeBackPress = new Date().getTime()
}
} else {
outlet.pop()
window.history.back()
}
})
})
}