HTML:
<a href="#!uploadstatus"><button type="submit" class="btn btn-primary" confirm-ng-click="Are you sure">Submit</button></a>
angular js is :
omapp.directive("confirmNgClick",function(){
return {
priority:-1,
restrict:'A',
link: function(scope,element,attrs){
element.bind('click',function(event){
var message = attrs.confirmNgClick || "Are you sure?";
if (message && !confirm(message)){
event.stopImmediatePropagation();
event.preventDefault();
} //if
}) // bind
}//function
}
})
When I click the button, it raises a confirm box. When I click "yes", the page go to next page. Everything is fine. I want to improve the design of the confirm box using bootbox.
I have made changes to the angularjs directive as shown below :
omapp.directive("confirmNgClick",function(){
return {
priority:-1,
restrict:'A',
link: function(scope,element,attrs){
element.bind('click',function(event){
var message = attrs.confirmNgClick || "Are you sure?";
bootbox.confirm(message,function(result){
if (! result){
event.stopImmediatePropagation();
event.preventDefault();
}
})
}) // bind
}//function
}
})
However, things are not working as expected. Can someone help me troubleshoot this issue?
Thank you for any assistance provided.