gpt4 book ai didi

angularjs - 字形上的点击事件

转载 作者:行者123 更新时间:2023-12-04 15:10:27 24 4
gpt4 key购买 nike

如何将 ng-click 事件添加到文本框中的 bootstrap glyphicon?事件不会被解雇...

<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 link

最佳答案

发生这种情况是因为字形提供了“指针事件:无;”默认情况下,您可以通过简单的 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>

Plunker

关于angularjs - 字形上的点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29047573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com