简体   繁体   English

事件未在Firefox中定义,但在chrome上有效

[英]event not defined in firefox but working on chrome

I have the following function :- 我有以下功能:

$scope.getBillDetails=function($event){ bill_id=event.target.id

And I call it in the following way on ng-click:- 我在ng-click上以以下方式调用它:-

<td><button type="button" id="{{user.bill_id}}" href="#mySlider2" data-slide="next" class="btn btn-primary right" ng-click="getBillDetails($event)">View Details</button></td>

My code is working fine on Chrome but it fails in firefox saying event not defined. 我的代码在Chrome上运行正常,但在Firefox中失败,提示未定义事件。 Can someone please help me out. 有人可以帮我吗。 I saw some other posts regarding the same issue but did not get any proper solution. 我看到了有关同一问题的其他一些帖子,但没有得到任何适当的解决方案。

Use the argument you named as $event 使用您命名为$event的参数

Change 更改

$scope.getBillDetails=function($event){
    bill_id=event.target.id

To

$scope.getBillDetails=function($event){
    bill_id=$event.target.id
           // ^^ matches function argument

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM