I am calling a sweetalert on basis of the result of an if statement.
for (int i = 0; i < count; i++) {
if (numValue == 0) {
swal({
title: 'Warning',
text: "Hey there..!!",
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'No',
confirmButtonClass: 'confirm-class',
cancelButtonClass: 'cancel-class',
allowOutsideClick: false
}, function(isConfirm) {
if (isConfirm) {
console.log("isConfirm in if: " + isConfirm);
$scope.$apply(function() {
$scope.saveAfterPSConfirm();
});
} else {
console.log("isConfirm in else: ");
return;
}
}
);
}
}
This calls a warning sweet alert if numValue is 0. For sample, numValue is 0.
While calling this snippet, sweet alert warning message "Hey there..!!" comes but immediately dissolves, without waiting for any button click for numValue popup. The issue is callback function of numvalue sweet alert is not getting called.