I have the below code for a delete button in the controller,
$scope.removes = function (scope) {
toastr.success("Delete all?","<br /><br /><button type='button' class='btn clear'>Yes</button>",{
closeButton: false,
onClick: function(){
var nodeData = scope.$modelValue;
if(nodeData.nodes.length > 0){
toastr.error('Cant delete Sub levels available :', 'Warning', {
closeButton: true
});
}else{
mainMenuService.deleteData(nodeData).success(function(data) {
scope.remove();
toastr.success(data.message, 'Message', {
closeButton: true
});
}).error(function(err) {
toastr.error(err, 'Warning', {
closeButton: true
});
});
}
}
})
}
I want to show a confirmation dialog box and want to delete if the use click yes button. But I can't see any button in the toastr message and I don't know how to do it. I have done it exactly as in the documentation. And I want to know if it is possible to put two buttons in the confirmation message?
In case anyone is NOT after Angular solution but back to the basics here it is, really simple.
toastr.success("<br /><br /><button type='button' id='confirmationButtonYes' class='btn clear'>Yes</button>",'delete item?',
{
closeButton: false,
allowHtml: true,
onShown: function (toast) {
$("#confirmationButtonYes").click(function(){
console.log('clicked yes');
});
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With