Reputation: 1353
I have a project with Angular 8 where I want to handle touch events. Example handler:
@HostListener('touchend', ['$event']) onTouchend(event: TouchEvent) {
event.preventDefault();
}
I am running on MacOS 10.15 and this works fine i Chrome, but in Safari I get this error message and my app doesn't run: "ReferenceError: Can't find variable: TouchEvent" and in Firefox "ReferenceError: TouchEvent is not defined". If I change the event type to any it runs in Safari and Firefox. Why can't I use the TouchEvent type in Safari?
Upvotes: 5
Views: 3029
Reputation: 2642
Somewhere in your app add the following line:
export type AppTouchEvent = TouchEvent;
Then use AppTouchEvent
in your ts files instead of TouchEvent
.
Upvotes: 6