Had created sweet alert as seperate service and Im injecting that inro my service
This is the sweet alert service
(function(){
\'use strict\';
I think you should change implementation of sweeet alert
confirm box. The way confirm
method of sweet alert implement, you need to pass pass a callback
to execute to confirm
method and execute over there.
confirm: function(title, message, callback) {
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Ok',
cancelButtonText: "Cancel",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
callback(isConfirm)
});
};
Controller
$scope.updateRow = function(row, event) {
vm.clear();
SweetAlert.confirm('Are you sure?', null, function(isConfirmed) {
if (isConfirmed) {
vm.save(row.entity);
} else {
event.preventDefault();
}
});
};