Hi, i’m trying to implement hardware backbutton to close the app only when i’m one of the pages registered in my tabs.
I tryied to implement in my tabs.ts page and it extended to my entire app, so i put my code on the 4 views from the tabs, here is the core i have:
import { Component } from '@angular/core';
import { NavController, Platform, AlertController } from 'ionic-angular';
@Component({
selector: 'page-usuario-amigos',
templateUrl: 'usuario-amigos.html'
})
export class UsuarioAmigosPage {
constructor(public navCtrl: NavController, public plat: Platform, public alert: AlertController) {
this.plat.registerBackButtonAction(() => {
let confirm = this.alert.create({
title: 'Sair',
message: 'Deseja realmente fechar o FutClub?',
buttons: [
{
text: 'Nao',
handler: () => {
confirm.dismiss();
}
},
{
text: 'Sim',
handler: () => {
this.plat.exitApp();
}
}
]
});
confirm.present();
});
}
}
i have this code on other 3 tabs page, but still it’s showing from every other pages.
What am i doing wrong? How can i let this ONLY on the tabs page?