点击事件在glypicon [英] Click event on glypicon

查看:72
本文介绍了点击事件在glypicon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本框中将ng-click事件添加到引导glyphicon?该事件不会被触发...

How do I add a ng-click event to a bootstrap glyphicon in a textbox? The event doesn't get fired...

<body ng-app ng-init="mymodel='THIS IS MY MODEL'">
    <h3>How to clear the model on remove icon click?</h3>
    <div class="container">
    <div class="form-group has-feedback" >
      <input type="text" class="form-control" ng-model="mymodel"/>
       <i class="glyphicon glyphicon-remove form-control-feedback" 
       ng-show="mymodel" ng-click="mymodel = null"></i>
     </div>
    <p>This is my model: {{mymodel}}</p>

    <strong ng-click="mymodel = null">This works tho...</strong>
    </div>
</body>

Plnkr链接

推荐答案

之所以会发生这种情况,是因为字形文字提供了指针事件:无;"默认情况下,您可以覆盖它,并通过简单的CSS删除此功能:-)

This is happening because glyphicons provided with " pointer-events: none;" as default you can override it and remove this functionality by simple CSS:-)

 .my .glyphicon {
      pointer-events: all;
    }

<div class="form-group has-feedback my" >
      <input type="text" class="form-control" ng-model="mymodel"/>
       <i class="glyphicon glyphicon-remove form-control-feedback" 
       ng-show="mymodel" ng-click="mymodel = null"></i>
     </div>

柱塞

这篇关于点击事件在glypicon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆