简体   繁体   中英

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:-

<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. 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

Change

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

To

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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