Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Created October 13, 2021 20:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ssougnez/63a45153085547dc8633eb2a8e2fb083 to your computer and use it in GitHub Desktop.
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