簡體   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