-
+
Graph Analysis
diff --git a/src/app/analytics/analytics.component.ts b/src/app/analytics/analytics.component.ts
index 6143cc7..01b97fd 100644
--- a/src/app/analytics/analytics.component.ts
+++ b/src/app/analytics/analytics.component.ts
@@ -59,11 +59,6 @@ export class AnalyticsComponent implements OnInit, OnDestroy {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe());
}
- this.subs.push(this.route.fragment.subscribe(fragment => {
- setTimeout(() => {
- this.goTo(fragment);
- }, 100);
- }));
this.init();
this.search(true);
for(let i = 0; i < 3; i++) {
@@ -188,15 +183,6 @@ export class AnalyticsComponent implements OnInit, OnDestroy {
}
}
- goTo(id: string) {
- const yOffset = -100;
- const element = document.getElementById(id);
- if(element) {
- const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
- window.scrollTo({top: y, behavior: 'smooth'});
- }
- }
-
public getSafeUrl(url: string): SafeUrl {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 0d18533..155fa78 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,17 +1,18 @@
-import {Component, OnInit} from '@angular/core';
+import {Component, OnDestroy, OnInit} from '@angular/core';
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {User} from './openaireLibrary/login/utils/helper.class';
import {properties} from '../environments/environment';
import {LayoutService} from './services/layout.service';
import {Header} from './openaireLibrary/sharedComponents/navigationBar.component';
+import {SmoothScroll} from './openaireLibrary/utils/smooth-scroll';
@Component({
selector: 'app',
templateUrl: './app.component.html',
})
-export class AppComponent implements OnInit {
+export class AppComponent implements OnInit, OnDestroy {
title = 'Metadata Registry Service';
userMenuItems: MenuItem[] = [];
menuItems: RootMenuItem [] = [];
@@ -24,7 +25,8 @@ export class AppComponent implements OnInit {
header: Header;
logoPath: string = 'assets/common-assets/';
- constructor(private layoutService: LayoutService) {}
+ constructor(private layoutService: LayoutService,
+ private smoothScroll: SmoothScroll) {}
ngOnInit() {
this.logInUrl = this.properties.loginUrl;
@@ -79,4 +81,8 @@ export class AppComponent implements OnInit {
}].concat(this.menuItems);
}
}
+
+ ngOnDestroy() {
+ this.smoothScroll.clearSubscriptions();
+ }
}
diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
index 141ff97..9fee8fd 100644
--- a/src/app/app.routing.ts
+++ b/src/app/app.routing.ts
@@ -43,7 +43,8 @@ const appRoutes: Routes = [
@NgModule({
imports: [RouterModule.forRoot(appRoutes, {
preloadingStrategy: PreloadAllModules,
- scrollPositionRestoration: 'top'
+ onSameUrlNavigation: "reload",
+ relativeLinkResolution: 'corrected'
})],
exports: [RouterModule]
})
diff --git a/src/app/resources/resources.component.html b/src/app/resources/resources.component.html
index 5de7e90..bed4804 100644
--- a/src/app/resources/resources.component.html
+++ b/src/app/resources/resources.component.html
@@ -39,7 +39,7 @@
diff --git a/src/app/resources/resources.component.ts b/src/app/resources/resources.component.ts
index b37de0b..317e924 100644
--- a/src/app/resources/resources.component.ts
+++ b/src/app/resources/resources.component.ts
@@ -49,11 +49,6 @@ export class ResourcesComponent implements OnInit, OnDestroy {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe());
}
- this.subs.push(this.route.fragment.subscribe(fragment => {
- setTimeout(() => {
- this.goTo(fragment);
- }, 100);
- }));
}
public ngOnDestroy() {
@@ -63,13 +58,4 @@ export class ResourcesComponent implements OnInit, OnDestroy {
}
});
}
-
- goTo(id: string) {
- const yOffset = -100;
- const element = document.getElementById(id);
- if(element) {
- const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
- window.scrollTo({top: y, behavior: 'smooth'});
- }
- }
}
diff --git a/src/index.html b/src/index.html
index 5feb796..99da8af 100644
--- a/src/index.html
+++ b/src/index.html
@@ -27,4 +27,5 @@