From b0d117992055c72075e1f856b150e9011e8800e2 Mon Sep 17 00:00:00 2001 From: Pat Herlihy Date: Thu, 20 Sep 2018 16:36:46 -0400 Subject: [PATCH] fix(route-href): prefix the pathname for fragment hrefs --- src/route-href.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/route-href.js b/src/route-href.js index b101c28..76796cb 100644 --- a/src/route-href.js +++ b/src/route-href.js @@ -47,6 +47,11 @@ export class RouteHref { let href = this.router.generate(this.route, this.params); + // Prefix pathname and search to fragment? + if (href.startsWith('#') && window.location) { + href = `${window.location.origin}${window.location.pathname}${window.location.search}${href}`; + } + if (this.element.au.controller) { this.element.au.controller.viewModel[this.attribute] = href; } else {