From 1ff59c5f54bee42cdadbce66d87d4530b9a7860d Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:46:09 +0900 Subject: [PATCH] bug fixed --- src/app/layouts/components/default.layout.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/layouts/components/default.layout.component.ts b/src/app/layouts/components/default.layout.component.ts index 25396bb..eeb9001 100644 --- a/src/app/layouts/components/default.layout.component.ts +++ b/src/app/layouts/components/default.layout.component.ts @@ -12,7 +12,7 @@ import { LogService } from '@ucap/ng-logger'; import { AppSelector } from '@app/store/state'; -const NAVS = ['group/', 'chat/', 'organization/', 'message/']; +const NAVS = ['group', 'chat', 'organization', 'message']; @Component({ selector: 'app-layouts-default', @@ -48,6 +48,8 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy { } } }); + + this.setTabGroup(this.router.url); } ngOnDestroy(): void { @@ -70,4 +72,10 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy { this.leftSidenav.open(); } } + + private setTabGroup(url: string) { + this.navTabGroup.selectedIndex = NAVS.findIndex((v) => + url.startsWith(`/${v}`) + ); + } }