popconfirm不表工作(小于TD&GT) [英] popconfirm doesn't work in table (<td>)
问题描述
我在playframework Scala的应用程序的工作,我想用酥料饼确认在智能表,我也安装了popconfirm(popconfirm:0.4.3)和它的作品很好,除了在完全相同的&LT表; TD&GT;
< IMG SRC =http://i.stack.imgur.com/EGE6q.pngALT =在这里输入的形象描述>
I'm working in a scala application with playframework, I want to use the popover confirm in a smart-table, I did the install for the popconfirm ("popconfirm":"0.4.3") and it works well except in the table exactly in <td>
还有就是我的code的一部分:
there is a part of my code:
<table st-table="topics" st-safe-src="topicList" class="table table-striped">
<thead>
<tr>
<th st-sort="domain">Domain</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="topic in topics">
<td>{{topic.domain}}</td>
<td class="text-center">
<div class="btn-group btn-group-xs">
<a href="javascript:void(0)" data-toggle="tooltip" data-original-title="Edit" class="btn btn-default" ng-click="showTopic(topic)" title><i class="fa fa-pencil"></i></a>
<button href="" type="submit" data-toggle="tooltip" data-original-title="Remove" class="btn btn-danger popconfirm" ng-click="removeTopic(topic)" title><i class="hi hi-remove"></i>
</button>
<button type="submit" class="btn btn-success popconfirm" href="@routes.Application.index()">Test</button>
</div>
</td>
<button type="submit" class="btn btn-success popconfirm" href="@routes.Application.index()">Work</button>
</tr>
</tbody>
</table>
<script src="@routes.Assets.versioned("temp/js/vendor/jquery-1.12.0.min.js")"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".popconfirm").popConfirm();
});
</script>
确认键工作运作良好,但测试不工作,任何帮助吗?
the confirm button "work" is working well but test doesn't work, any help please?
推荐答案
以上code不工作,因为它是调用 $(popconfirm)popConfirm();
渲染前法 NG-重复
(它呈现内容懒洋洋地)的内容。因此,它是无所事事。
The above code is not working because, it is calling $(".popconfirm").popConfirm();
method before rendering ng-repeat
(it render content lazily) content. So it is doing nothing.
为了解决这个问题,你需要创建一个指令,使在该 popConfirm
功能按钮
一旦度日渲染NG-重复
。你可以使用指令链接
函数获得角编译元素
调用 popConfirm()
的方法就可以了。
For solving the issue, you need to create a directive that will enable popConfirm
feature on that button
once it get render by ng-repeat
. You could use directive link
function to get angular compiled element
to call popConfirm()
method of it.
指令
app.directive('popconfirm', function(){
return {
restrict: 'C',
link: function(scope, element){
element.popConfirm();
}
}
})
这篇关于popconfirm不表工作(小于TD&GT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!