如何在 PopConconfirm 中单击按钮 yes 时调用在 Angular 控制器中声明的删除函数



我正在开发一个带有播放框架的 scala 应用程序,我想在智能表中使用弹出框确认来删除情况,问题是如何执行在 popconconfirm 的点击是按钮上在角度控制器中声明的删除函数?

 <button type="button" data-toggle="tooltip" data-original-title="Remove" class="btn btn-danger popconfirm" btn-delete><i class="hi hi-remove"></i>
                        </button>

有我的jquery-popconfirm file:http://pastebin.com/SinHkqCi

我也使用此指令来调用我的弹出确认:

app.directive('popconfirm', function(){
return {
  restrict: 'C',
  link: function(scope, element){
    element.popConfirm();
  }
};
});

如果您使用的是 bootstrap 的 popconfirm,我在这里找到了这个例子:

http://jsfiddle.net/RDh7E/28/

尝试这样的事情(来自提到的示例)

// (example jquery click event)
$('#important_action').click(function() {
    alert('You clicked, and valided this button !');
});
// Full featured example
$("[data-toggle='confirmation']").popConfirm({
    title: "Really ?",
    content: "I have warned you !",
    placement: "bottom"
});

.html

<button class="btn btn-success popconfirm_full" data-toggle='confirmation' id="important_action">Full featured</button>

重要的是,按钮上的单击事件调用应该执行的函数(可能也可以使用 angular 的 ng-click),并且 popconfirm 通过 data-toggle='confirmation' 处理。这个例子有效,但我还没有尝试过自己。

最新更新