SweetAlert2 - Bind another event to cancel button?
Just add your custom function to catch the rejection, for example:
swal({
title: 'Some title',
text: 'some text for the popup',
type: 'warning',
showCancelButton: true,
cancelButtonText: 'Some text for cancel button'
}).then(function(){
// function when confirm button clicked
}, function(dismiss){
if(dismiss == 'cancel'){
// function when cancel button is clicked
}
});
You can even add more function to catch another dismiss event, just read SweetAlert2 Docs for more info about dismiss event.
with a little customization to @Raditya Adi Baskara answer,
swal({
title: "$titleWarnignBox",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#36c6d3',
cancelButtonColor: '#d33',
confirmButtonText: '$confrimBtn',
cancelButtonText: '$cancelBtn'
}).then(function(result){
if(result.value){
console.log('good');
}else if(result.dismiss == 'cancel'){
console.log('cancel');
}
});