admin管理员组文章数量:1315941
I have added my demo to: this link When I click on thumbs up (es from fontawesome) ng-click does not trigger and like count does not change. When I click to xyz, like count increases.
This is not working:
<i ng-click="LikeComment(ment)" class="far fa-thumbs-up"></i> {{ment.like}}
But this is working:
<i ng-click="LikeComment(ment)">xyz</i> {{ment.like}}
I have added my demo to: this link When I click on thumbs up (es from fontawesome) ng-click does not trigger and like count does not change. When I click to xyz, like count increases.
This is not working:
<i ng-click="LikeComment(ment)" class="far fa-thumbs-up"></i> {{ment.like}}
But this is working:
<i ng-click="LikeComment(ment)">xyz</i> {{ment.like}}
Share
Improve this question
asked Mar 2, 2018 at 13:31
Enes KöroğluEnes Köroğlu
1845 silver badges16 bronze badges
2
-
You should wrap icons with actions in a button:
<button ng-click="LikeComment(ment)"><i class="fa fa-thumbs-up"></i></button
– devqon Commented Mar 2, 2018 at 13:36 -
1
<div ng-click="LikeComment(ment)"><i class="far fa-thumbs-up"></i> {{ment.like}}</div>
div will make it as well ;p – Vossen Commented Mar 2, 2018 at 13:38
2 Answers
Reset to default 6Try this:
<span ng-click="LikeComment(ment)"><i class="far fa-thumbs-up"></i></span>{{ment.like}}
OR, in case you are ok with a button
<button ng-click="LikeComment(ment)"><i class="far fa-thumbs-up"></i></button>{{ment.like}}
Font awesome turns it into a <svg>
tag which doesn't seem to collaborate too well with the click handler. Try wrapping the <i>
in a <div>
like this
https://jsfiddle/wewekvkw/26/
本文标签: javascriptngclick not working in fontawesome iconStack Overflow
版权声明:本文标题:javascript - ng-click not working in font-awesome icon - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741988272a2408813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论