From c780182a0893662a92d6183173e4faaf3b80d89f Mon Sep 17 00:00:00 2001 From: Severin Beauvais Date: Tue, 2 Oct 2018 15:20:24 -0700 Subject: [PATCH] PRC-713: changes to make fragment code work --- .../application-add-edit.component.html | 4 ++-- .../application-add-edit/application-add-edit.component.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/applications/application-add-edit/application-add-edit.component.html b/src/app/applications/application-add-edit/application-add-edit.component.html index ee3cf2da..0a3cfeba 100644 --- a/src/app/applications/application-add-edit/application-add-edit.component.html +++ b/src/app/applications/application-add-edit/application-add-edit.component.html @@ -1,4 +1,4 @@ -
+
@@ -26,7 +26,7 @@

Crown land File: {{application['clFile']}}  &r

-
+
diff --git a/src/app/applications/application-add-edit/application-add-edit.component.ts b/src/app/applications/application-add-edit/application-add-edit.component.ts index 48fd1bfc..7ce9c7e5 100644 --- a/src/app/applications/application-add-edit/application-add-edit.component.ts +++ b/src/app/applications/application-add-edit/application-add-edit.component.ts @@ -63,11 +63,11 @@ export class ApplicationAddEditComponent implements OnInit, OnDestroy { router.events.subscribe(event => { if (event instanceof NavigationEnd) { const url = router.parseUrl(router.url); - if (url.fragment) { + if (url && url.fragment) { // ensure element exists - const element = document.querySelector('#' + url.fragment); + const element = document.getElementById(url.fragment); if (element) { - document.getElementById(url.fragment).scrollIntoView(); + element.scrollIntoView(); } } }