0

I am new to AngularJS so not aware of events of this. I have a requirement that I have jQuery bootstrap library. I want to open that bootstrap confirmbox when I click on a button and based on ok and cancel want to take further action But want to call using AgularJS

1 Answer 1

1

First if at all possible, if you intend to use angular try not to use jQuery functionality, unless it is a last resort.

In order to accomplish what you want you would need to write a angular directive that handles the confirm box and then use it any where you need confirmations. The directive can be setup to further handle actions on ok and cancel. Something similar to this might give you a stating point.

app.directive('ngConfirm', [
    function(){
        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                element.bind('click',function () {
                    var message = attrs.ngConfirmMessage || "Are you sure?"
                    if (message && confirm(message) ) {
                        scope.$apply(attrs.ngConfirm)
                    }
                });
            }
        };
}])

and then in the html

<tag ng-Confirm-Message="Some message" ng-Confirm="someAction()"></tag>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.