I am facing an issue with my Angular 2 website where it is not functioning correctly in Firefox. The main problem lies in the fact that Firefox does not recognize the event being passed into my TypeScript function. This event specifically pertains to a mouse click, and the function serves as a mouse click event handler.
Here is what the HTML/Angular code looks like:
<div class="click-to-filter-outer" (click)="clickToFilter_Clicked(e)">
And this is how the TypeScript code appears:
clickToFilter_Clicked(e) {
$('.filter-panel').css('max-height', '500px');
this.filterPanelState = this.filterPanelStates.EXPANDED;
e.stopPropagation();
}
The error message shown in the Firefox console reads as follows:
TypeError: e is undefined
In contrast, other browsers do not require me to pass the click event into the function. Instead, I can retrieve it by calling window.event like this:
clickToFilter_Clicked() {
$('.filter-panel').css('max-height', '500px');
this.filterPanelState = this.filterPanelStates.EXPANDED;
window.event.stopPropagation();
}
What is the correct method for obtaining the click event within a click event handler in Firefox while running an Angular site with TypeScript? If the code presented above is accurate, what could be causing Firefox to indicate that it does not recognize the event variable?
Thank you.