Good Morning,
I'm trying to do an implementation with SweetAlert2 and I am not able to reach a positive conclusion. You could answer me if you can and help me?
I am creating a SWAL where the html has buttons as code below:
setTimeout(function () {
$scope.$apply(function () {
swal({
title: "Lan莽amento por C贸digo",
width: 400,
html: "" +
" <div>" +
" <input type='button' id='btn0' name='btn0' value='0' />" +
" </div>" +
showCancelButton: true,
confirmButtonColor: "#FFB200",
cancelButtonColor: "#FFB200",
colorHoverButton: "#5B2E90",
confirmButtonText: "Confirmar",
cancelButtonText: "Cancelar",
closeOnConfirm: true,
reverseButtons: true,
input: "text"
}).then(function () {
});
})
},0);
I am using setTimeOut and $ scope. $ Apply () as the code above.
I am creating a click event to the button, as the code below, but it is not working that part. The button does not call the click event.
setTimeout(function () {
$scope.$apply(function () {
$("input[name='btn0']").on("click", function () {
$scope.valorLancProduto += "0";
$('.swal2-input').val($scope.valorLancProduto);
});
})
},0);
Everything is within a controller, and the click event is the init function of the controller.
Please could you help me solve this problem?
I thank you for your attention and help.