Hi there.
If my app pushs a new Page to the screen, there is automatically added an left pointing arrow for leaving.
Now I want to prevent the User from leaving the screen if some of his form inputs are out of range.
ionViewCanLeave(): boolean {
if(!this.dailyHours.valid) {
this.alertCtrl.create({
title: 'Wirklich verlassen?',
message: 'Deine Studenanzahl liegt nicht im Rahmen von 6 bis 10 Stunden. Die Änderung wird nicht gespeichert. Möchtest du fortfahren?',
buttons: [
{
text: 'Ja',
handler: () => {
return true;
}
},
{
text: 'Nein',
handler: () => {
return false;
}
}
]
}).present();
} else {
return true;
}
}
The alert is shown correctly, but the app page is closing in background.
Thats my first problem. My second problem is, that the alert only closes when I click on “Ja”. If I select “Nein” nothing happens.
I hope someone can help me.