【发布时间】:2015-04-24 09:07:44
【问题描述】:
我正在使用甜蜜警报库,但取消按钮有问题。这是我的甜蜜警报代码:
sweetAlert({
title: title,
text: text + ' ' + courseList,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: confirmButtonText,
cancelButtonText: "Continue with purchase",
closeOnConfirm: false,
closeOnCancel: false,
html: true
},
function(isConfirm) {
if (isConfirm) {
angular.forEach(repeatedCourses, function(repeatedCourse) {
$rootScope.$apply(function() {
this.removeCoursePurchase(repeatedCourse);
}.bind(this));
}.bind(this));
$rootScope.$broadcast('uncheckCheckboxes');
swal("Deleted!", "Your purchase has been refreshed.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
}.bind(this));
当用户点击确认按钮时,工作正常,但如果点击取消按钮没有任何作用,它不会出现“取消”框,我不知道为什么!
【问题讨论】:
-
@RGraham 函数 sweetAlert 的缩写
-
您是否在
else语句上设置了断点?会被击中吗? -
是的,当用户点击取消按钮时它不会进入
function(isConfirm){},但点击接受时它会进入。 @RGraham -
@Crisiiii 你解决了吗?
标签: javascript angularjs bind sweetalert