繁体   English   中英

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

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

我有以下功能:

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

我在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>

我的代码在Chrome上运行正常,但在Firefox中失败,提示未定义事件。 有人可以帮我吗。 我看到了有关同一问题的其他一些帖子,但没有得到任何适当的解决方案。

使用您命名为$event的参数

更改

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

$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