本文介绍了AngularJS:基于鼠标事件显示隐藏元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一个例子 -

Here is an example - http://plnkr.co/edit/iwvjJcUurUW2AvkDArfz?p=preview

我想删除按钮显示,只有当鼠标悬停在该行,并执行一些函数删除(名称),通过将名称

I would like the delete button to show up only when mouse hovers on the row and perform some function delete(name), by passing the name

我怎样才能做到这一点?

How can I achieve this?

P.S我是新来的角的世界

P.S I am new to Angular world

推荐答案

这可以迅速用CSS解决,没有必要把JS或角。
仅仅使用基本的CSS是在我看来,更好的解决方案。
以下添加到您的样式表:

This can be quickly solved with CSS, no need to bring JS or Angular.Just using basic CSS would be in my opinion better solution.Add the following to your stylesheet:

 <style>
   tr i.icon-minus-sign { display: none; }
   tr:hover i.icon-minus-sign { display: block; };
 </style>

这篇关于AngularJS:基于鼠标事件显示隐藏元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:42
查看更多