Even though I'm defining the event and it works in Chrome it does not work in Firefox?
app.controller('lightbox_close_controller', ['$scope', '$rootScope', function($scope, $rootScope) {
$scope.close_rating_lightbox = function(event) {
if (!$(".lightbox").hasClass("mobile_ratebox")) {
event.stopPropagation();
$("#image_in_lightbox_inside").empty();
}
}
}
]);
the same issue in Angular 2 , firefox is more strict in event declaration
//in chrom works fine
//in firefox throws event is undefined
@HostListener('click') onClick() {
console.info(event);
}
// to fix it you have to add
@HostListener('click', ['$event']) onClick(event) {
console.log(event)
}
Pass $event
from ui
like
<button ng-click="close_rating_lightbox($event)">Click Me</button>
I discovered that you can also get this error if you forget to add the event argument if in the event handler, i.e.
onClicked(event){
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With