如何在Angular JS中单击链接时显示弹出窗口

时间:2019-01-17 09:16:02

标签: angular

 <button type="button" ng-click="delete()" confirm-if="checked" confirm="Are you sure, {{name}}?">Delete</button>

这对按钮有效,我可以弹出窗口,但对于链接,它不能正常工作。以下是我的代码

 i want the confirm popup on clicking the link instead of button
<a ng-click="delete()" confirm-if="checked" confirm="Are you sure you want to delete it anyhow?">delete</a>      

1 个答案:

答案 0 :(得分:0)

您可以更改按钮样式,使其看起来像一个链接。详细的answer

HTML:

<button class="link-button" type="button" ng-click="delete()" confirm-if="checked" confirm="Are you sure, {{name}}?">Delete</button>

CSS:

.link-button {
 background:none!important;
 color:inherit;
 border:none; 
 padding:0!important;
 font: inherit;
 /*border is optional*/
 border-bottom:1px solid #444; 
 cursor: pointer;

}