-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(demo): Fixed routings issue for links with inner html tags. #3816
Conversation
@@ -17,7 +17,7 @@ export class ExamplesComponent { | |||
|
|||
@HostListener('document:click', ['$event']) | |||
preventEmptyHrefNav(event: Event) { | |||
if (event && event.target && (event.target as Element).getAttribute('href') === '#') { | |||
if (event && event.target && (event.target as Element).getAttribute('href') === '#' || event.srcElement.parentElement && (event.srcElement.parentElement as Element).getAttribute('href') === '#') { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## development #3816 +/- ##
==============================================
Coverage ? 72.03%
==============================================
Files ? 252
Lines ? 8159
Branches ? 1552
==============================================
Hits ? 5877
Misses ? 1859
Partials ? 423 Continue to review full report at Codecov.
|
element = element.parentElement; | ||
linkPrevent = event && element && (element as Element).getAttribute('href') === '#'; | ||
} | ||
} else { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (event && event.target && (event.target as Element).getAttribute('href') === '#') { | ||
event.preventDefault(); | ||
preventEmptyHrefNav(event: Event): void { | ||
let element = event.srcElement; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (event && event.target && (event.target as Element).getAttribute('href') === '#') { | ||
preventEmptyHrefNav(event: Event): any { | ||
let element: any = event.target; | ||
let linkPrevent = event && element.getAttribute('href') === '#'; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (event && event.target && (event.target as Element).getAttribute('href') === '#') { | ||
preventEmptyHrefNav(event: Event): any { | ||
let element: any = event.target; | ||
let preventNav = event && element.getAttribute('href') === '#'; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return; | ||
} | ||
element = element.parentElement; | ||
preventNav = event && element.getAttribute('href') === '#'; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Tested, looks good |
preventEmptyHrefNav(event: Event) { | ||
if (event && event.target && (event.target as Element).getAttribute('href') === '#') { | ||
preventEmptyHrefNav(event: Event): any { | ||
let element: any = event.target; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@valorkin fixed it |
Fixed routings issue for links with inner html tags.
this pr should be merged before pr #3812
Closes #3813