I am trying to use Bootstrap-Confirmation plugin with AngularJS, but I cannot seem to get the directive to work properly. I am using this YouTube video to get going.
A similar SO question uses another plugin called popConfirm, but it is used in similar way. I tried to replicate the directive, but that did not work either.
I want to show a confirmation dialog when the button is clicked, and IF 'Yes' is clicked, only then go through would ng-click function.
Here is a JSFiddle Demo of it working in JQuery.
And here is a Plnkr Demo of what I have so far.
Script Order:
- JQuery.js
- Angular.js
- UI-Bootstrap.js
- Bootstrap.css
- Boostrap-Confirmation.js
- app.js
Main HTML:
<button class="btn btn-xs btn-primary" pop-confirm ng-click="confirm()">Confirm</button>
App Directive:
app.directive('popConfirm', function(){
var linker = function(scope, element, attr) {
element.confirmation();
};
return {
link: linker
};
});