【问题标题】:How to show bootstrap confirm box in button click function , angular js?如何在按钮单击功能,角度js中显示引导确认框?
【发布时间】:2014-09-30 10:16:21
【问题描述】:

下面是在我的 angular.js 应用程序的 ctrl.js 中单击提交按钮的代码

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

btnID 是提交按钮的 ID。第一次点击提交按钮后,它会显示 引导确认框 和是和否按钮。如果我单击 Yes 按钮,那么它会调用 onConfirm 方法,然后再次调用此提交按钮单击函数。如果我第二次点击提交按钮,它会调用这个提交按钮点击功能,但它不显示确认框。

【问题讨论】:

  • 是否有可能有一个 plunker 的例子?
  • 没有。有没有可能找出我在上面的 f 代码中出错的地方?请
  • 使用 plunker 解决问题会更容易。我们只能猜测出了什么问题,我们无法真正弄清楚。如果由于某些敏感代码而无法设置 plunker,则应该设置一个简单的“Hello World”应用程序来实现这个确切的场景。
  • 你好,光,好的。我以后会做的。感谢您的回复

标签: jquery angularjs twitter-bootstrap


【解决方案1】:

我使用了下面的代码,它工作正常

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

请参考:http://bootboxjs.com/

【讨论】:

    【解决方案2】:

    您可能需要 angular-UI 引导库并将其用作

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

    请找图书馆here.

    【讨论】:

    • 您好 Mahesh Thumar,感谢您的回复。抱歉,我无法执行此操作。这是我已经在我的应用程序中实现的模态弹出窗口。但是对于这种情况,我想要上面提到的引导确认框。请告诉我哪里出错了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    • 2018-09-30
    • 2015-10-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-27
    • 1970-01-01
    相关资源
    最近更新 更多