-1
私はionic2を使用しています。 私はページ数が少なく、フローP1→P2→P3です。特定の条件のページ戻るボタン、Ionic2を防ぐ
P3にionViewCanLeave()
を使用したいので、特定の条件が満たされない場合、ユーザーが戻るボタンを押したときに警告が表示されます。
this.navCtrl.pop()
.catch(() => {
console.log('should I stay or should I go now');
});
ionViewCanLeave(): boolean{
// here we can either return true or false
// depending on if we want to leave this view
let percentMarks = Math.floor((this.totalCorrectAnswers/this.questionSetChosen.length) * 100);
if(percentMarks > 0){
return true;
} else {
return false;
}
}
ただし、エラーが発生しています。
どのようなエラーがありますか? –