I have a class that has a Boolean variable. This variable defines if a user receives a notification or not, but I want to use SweetAlert 2 to show the user an alert asking if he wants to receive the notification or not.
The problem is that the variable, being in the class, when executing an action in Sweetalert I do not have access to it because the sweetalert does it from a lambda
pauseTimer(event){
let _sendSmsNotification = false;
swal({
title: '¿Desea recibir una notificación?',
text: 'Podemos enviarte un sms para recordarte cuando el tiempo de este paso esté por terminar',
type: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '¡Si! Quiero recibir un mensaje'
}).then((result) => {
if (result.value) {
//Acá deseo realizar la modificación a la variable del componente
swal(
'¡Anotado!',
'Pronto recibirás un mensaje de texto al numero que registraste, indicandote cuando el temporizador esté llegando a su fin.',
'success'
)
}else{
swal('¡Muy bien!',
'No te molestaremos. Igual si quieres, podemos llevar el tiempo en pantalla para que no se te pase ',
'success');
}
});
I need to be able to access the component variable from the Then that makes sweet alert.