AS
Size: a a a
AS
AS
AS
Ć
Ć
Ć
Ć
Ć
Ć
AS
AS
AS
this.platform.backButton.subscribe(()=>{
this.logger.log(`back button pressed: ${this.router.url}`);
const n = this.router.getCurrentNavigation();
if( n ) {
this.logger.log(`current navigation: inital: ${n.initialUrl}, final: ${n.finalUrl}`);
}
});
AS
Ć
this.platform.registerBackButtonAction(() => {
// Catches the active view
let nav = this.app.getActiveNavs()[0];
let activeView = nav.getActive();
// Checks if can go back before show up the alert
if(activeView.name === 'HomePage') {
if (nav.canGoBack()){
nav.pop();
} else {
const alert = this.alertCtrl.create({
title: 'Fechar o App',
message: 'Você tem certeza?',
buttons: [{
text: 'Cancelar',
role: 'cancel',
handler: () => {
this.nav.setRoot('HomePage');
console.log('** Saída do App Cancelada! **');
}
},{
text: 'Fechar o App',
handler: () => {
this.logout();
this.platform.exitApp();
}
}]
});
alert.present();
}
}
});
Ć
Ć
AS
this.platform.registerBackButtonAction(() => {
// Catches the active view
let nav = this.app.getActiveNavs()[0];
let activeView = nav.getActive();
// Checks if can go back before show up the alert
if(activeView.name === 'HomePage') {
if (nav.canGoBack()){
nav.pop();
} else {
const alert = this.alertCtrl.create({
title: 'Fechar o App',
message: 'Você tem certeza?',
buttons: [{
text: 'Cancelar',
role: 'cancel',
handler: () => {
this.nav.setRoot('HomePage');
console.log('** Saída do App Cancelada! **');
}
},{
text: 'Fechar o App',
handler: () => {
this.logout();
this.platform.exitApp();
}
}]
});
alert.present();
}
}
});
Ć
Ć
Ć