简体   繁体   English

如何在按钮单击功能,角度js中显示引导确认框?

[英]How to show bootstrap confirm box in button click function , angular js?

Given below is the code for submit button click in ctrl.js of my angular.js application 下面给出的是我的angular.js应用程序的ctrl.js中的提交按钮单击的代码

namespace.btnClick = function {
     $('#btnID').confirmation({
           'onConfirm' : function () {
            return true;
     },'placement':right,'title' : "Alert"
});
$('#btnID').confirmation('show');

btnID is the id of the submit button. btnID是提交按钮的ID。 After clicking submit button for first time, it showing bootstrap Confirmation box with Yes and No button. 首次单击提交按钮后,它会显示带有“是”和“否”按钮的引导程序确认框 If I click Yes button then its calling onConfirm method, after that again its calling this submit button click function for first time. 如果我单击“ 是”按钮,则其调用onConfirm方法,此后再次调用其“提交”按钮click函数。 If I click submit button for second time, its calling this submit button click function but it doesn't show confirmation box. 如果我第二次单击提交按钮,它会调用此提交按钮单击功能,但不会显示确认框。

I used below code and its working fine 我用下面的代码及其工作正常

bootbox.confirm("Are you sure?", function(result) {
  Example.show("Confirm result: "+result);
}); 

Kindly refer this: http://bootboxjs.com/ 请参考: http : //bootboxjs.com/

You probably needs angular-UI bootstrap library and use it as 您可能需要angular-UI引导程序库并将其用作

var modalInstance = $modal.open({
      templateUrl: 'myModalContent.html',
      controller: 'ModalInstanceCtrl',
      size: size,
      resolve: {
        items: function () {
          return $scope.items;
        }
      }
    });

Please find the library here. 请在这里找到图书馆

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM