Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Created October 13, 2021 20:13
Embed
What would you like to do?
if (element.tagName === 'A') {
const href: string = element.href?.toLowerCase();
if (href?.startsWith(location.origin.toLowerCase())) {
element.addEventListener('click', (e: MouseEvent) => {
this._router.navigate([href.substring(location.origin.length)]);
e.preventDefault();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment