Hello I want to open dialog “Discard changes” in my app.
This dialog should open when you trying to go back when your form has content.
Example from Facebook app:
The form in my app is in modal, and it’s content is $scope.comment.data.content.
Code example (without back button event):
// On click back button
if($scope.comment.data.content.length > 0) {
$cordovaDialogs.confirm('If you go back now, your draft will be discarded.', 'Discard changes', [
'Discard',
'Keep'
]).then(function(buttonIndex) {
if(buttonIndex == 1) {
// Go back
} else if(buttonIndex == 2) {
// Stay here
}
});
} else {
// Go back
}