confirm value is not returning from sweet alert service

£可爱£侵袭症+ 提交于 2019-12-01 01:05:18

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();
    }
  });
};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!