Here is a button:
<button ng-click="deleteCompany(company.id)"
class="btn btn-danger"
onClick="return window.confirm('This will permanently delete the entity\n
Are you sure you want to delete this post?'); ">
<span class="glyphicon glyphicon-trash"></span>
</button>
Additionally, there is an angular function:
$scope.deleteCompany = function(id){
console.log(id);
}
After clicking "Cancel" in the confirm dialog, the console displays:
1
And when clicking "Ok," the console shows:
1
The goal is for the angular code to run only when "Ok" is pressed, not when "Cancel" is chosen.
View the JSFiddle demonstration here: http://jsfiddle.net/4304ewu5/