I encountered an issue while trying to target an event. Here is what I attempted:
public gotoPage(event: Event): void {
const gettest = (event.target as HTMLElement)?.getAttribute('href');
if (href) {
const testModule = "value1"
if (ssoModule) {
event.preventDefault();
}
}
}
HTML :
<ion-card-content>
<ion-item class="no-padding" (click)="gotoPage($event)">
<div>
{{test}}
</div>
</ion-item>
</ion-card-content>
However, the following errors occurred:
Property 'target' does not exist on type 'Event_2'.
Property 'target' does not exist on type 'RouterEvent'.
Property 'preventDefault' does not exist on type 'Event_2'.
Property 'preventDefault' does not exist on type 'RouterEvent'.
Currently, I am using type any to resolve the error. Is there a better solution to fix this issue?