admin管理员组文章数量:1277377
As you can see in the code, there are two onClick() methods. Both appear on the UI. But when I click on the second onClick() method, it doesn't call the method but the first one calls. I am not able to understand why this is happening. Please help.
<div class="col-sm-12 text-right mrg-top-15">
<div class="action-btns text-right flex">
<span class="icon-pending"></span>
<vh-button [type]="'trash'" (onClick)="navigateToHRA()" class="mrg-lft-10" id="icd-delete"></vh-button>
</div>
<button (onClick)="navigateToHRA()" class="btn btn-primary">{{'LookUpButtonText'|translate}}</button>
</div>
As you can see in the code, there are two onClick() methods. Both appear on the UI. But when I click on the second onClick() method, it doesn't call the method but the first one calls. I am not able to understand why this is happening. Please help.
<div class="col-sm-12 text-right mrg-top-15">
<div class="action-btns text-right flex">
<span class="icon-pending"></span>
<vh-button [type]="'trash'" (onClick)="navigateToHRA()" class="mrg-lft-10" id="icd-delete"></vh-button>
</div>
<button (onClick)="navigateToHRA()" class="btn btn-primary">{{'LookUpButtonText'|translate}}</button>
</div>
Share
Improve this question
asked Jan 30, 2019 at 12:11
Prashant YadavPrashant Yadav
5512 gold badges10 silver badges25 bronze badges
2 Answers
Reset to default 9You need to use (click)
when using Angular's click event.
<button (click)="navigateToHRA()" class="btn btn-primary">{{'LookUpButtonText'|translate}}</button>
The other (onClick)
event is most probably the output event emitter of vh-button
ponent/directive.
You have to use (click)
on the button instead of (onClick)
because that event does not exist on the native button.
本文标签: javascriptAngular Onclick() not working on second buttonStack Overflow
版权声明:本文标题:javascript - Angular Onclick() not working on second button - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741293769a2370700.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论