在我的 Angular 4 项目中,我使用的是 sweetalert 2 的主题,我想在用户单击确认按钮时调用我的方法,但似乎我无法在 then 函数中调用任何方法
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then(function () {
// I want to call my method here but I can't do this.myMethod()
})
我知道这不是有角的sweetalert,但是否有可能在不改变的情况下使其工作?