From e7e539183a5a672d9eb3f0978cf77ad56a0fc401 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 15 Jul 2019 12:32:41 +0000 Subject: [PATCH] [Admin|Trunk]: Fix menu issus like connect. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56550 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/app.component.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 8b7193d..9b9ccd5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -39,6 +39,16 @@ export class AppComponent implements OnInit{ private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService, private router: Router) { + this.router.events.forEach((event) => { + if (event instanceof NavigationStart) { + HelperFunctions.scroll(); + if(event.url === '/') { + this.wellcome = true; + } else { + this.wellcome = false; + } + } + }); } ngOnInit() { @@ -58,15 +68,8 @@ export class AppComponent implements OnInit{ this.isPortalAdministrator = Session.isPortalAdministrator(); } this._communitiesService.updateCommunities(this.properties, this.properties.communityAPI + 'communities'); - this.router.events.forEach((event) => { - if(event instanceof RoutesRecognized) { - HelperFunctions.scroll(); - if(event.url === '/') { - this.wellcome = true; - } else { - this.wellcome = false; - } - this.communityId = (event.state.root.firstChild.queryParams['communityId']) ? event.state.root.firstChild.queryParams['communityId'] : ''; + this.route.queryParams.subscribe(params => { + this.communityId = (params['communityId']) ? params['communityId'] : ''; this.communityType = null; this.menuItems = []; @@ -143,7 +146,6 @@ export class AppComponent implements OnInit{ } } ); - } }); }); }