From a52770c16e986232855e55f25daa7ac37c61dd02 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:45:10 +0900 Subject: [PATCH 1/4] bug fixed --- src/app/app-routing.module.ts | 111 ++++++++---------- .../components/default.layout.component.html | 11 +- .../components/default.layout.component.ts | 83 ++----------- .../pages/call/call-routing.page.module.ts | 15 ++- src/app/pages/call/components/index.ts | 3 +- .../call/components/sidenav.page.component.ts | 9 +- .../pages/chat/chat-routing.page.module.ts | 15 ++- src/app/pages/chat/components/index.ts | 4 + .../chat/components/sidenav.page.component.ts | 9 +- .../group/components/index.page.component.ts | 9 +- src/app/pages/group/components/index.ts | 4 + .../components/sidenav.page.component.ts | 13 +- .../pages/group/group-routing.page.module.ts | 15 ++- src/app/pages/message/components/index.ts | 4 + .../components/sidenav.page.component.ts | 13 +- .../message/message-routing.page.module.ts | 6 + .../pages/organization/components/index.ts | 4 + .../components/sidenav.page.component.ts | 15 +-- .../organization-routing.page.module.ts | 15 ++- .../organization/organization.page.module.ts | 7 +- src/app/types/tokens.ts | 6 +- 21 files changed, 148 insertions(+), 223 deletions(-) create mode 100644 src/app/pages/chat/components/index.ts create mode 100644 src/app/pages/group/components/index.ts create mode 100644 src/app/pages/message/components/index.ts create mode 100644 src/app/pages/organization/components/index.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e665806..1a37bb9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,5 +1,5 @@ import { NgModule } from '@angular/core'; -import { Routes, RouterModule, UrlSegment } from '@angular/router'; +import { Routes, RouterModule } from '@angular/router'; import { DefaultLayoutComponent } from '@app/layouts/components/default.layout.component'; import { NoNaviLayoutComponent } from '@app/layouts/components/no-navi.layout.component'; @@ -7,21 +7,12 @@ import { NoNaviLayoutComponent } from '@app/layouts/components/no-navi.layout.co import { AppAuthenticationGuard } from '@app/guards/app-authentication.guard'; import { AppSessionResolver } from './resolvers/app-session.resolver'; -export function appMatcher(url: UrlSegment[]) { - if (1 === url.length) { - if ( - ['organization', 'group', 'chat', 'message'].some((p) => - url[0].path.startsWith(p) - ) - ) { - return { consumed: url }; - } - } - return null; -} - const routes: Routes = [ - { path: '', redirectTo: '/organization', pathMatch: 'full' }, + { + path: '', + redirectTo: '/organization/(content:index)', + pathMatch: 'full' + }, { path: 'account', component: NoNaviLayoutComponent, @@ -39,59 +30,51 @@ const routes: Routes = [ ) }, { - matcher: appMatcher, + path: '', component: DefaultLayoutComponent, canActivate: [AppAuthenticationGuard], resolve: { - session: AppSessionResolver - } + authentication: AppSessionResolver + }, + children: [ + { path: '', redirectTo: '/organization', pathMatch: 'full' }, + { + path: 'organization', + loadChildren: () => + import('./pages/organization/organization.page.module').then( + (m) => m.AppOrganizationPageModule + ) + }, + { + path: 'group', + loadChildren: () => + import('./pages/group/group.page.module').then( + (m) => m.AppGroupPageModule + ) + }, + { + path: 'chat', + loadChildren: () => + import('./pages/chat/chat.page.module').then( + (m) => m.AppChatPageModule + ) + }, + { + path: 'call', + loadChildren: () => + import('./pages/call/call.page.module').then( + (m) => m.AppCallPageModule + ) + }, + { + path: 'message', + loadChildren: () => + import('./pages/message/message.page.module').then( + (m) => m.AppMessagePageModule + ) + } + ] }, - // { - // path: '', - // component: DefaultLayoutComponent, - // canActivate: [AppAuthenticationGuard], - // resolve: { - // authentication: AppAuthenticationResolver - // }, - // children: [ - // { path: '', redirectTo: '/organization', pathMatch: 'full' }, - // { - // path: 'organization', - // loadChildren: () => - // import('./pages/organization/organization.page.module').then( - // (m) => m.AppOrganizationPageModule - // ) - // }, - // { - // path: 'group', - // loadChildren: () => - // import('./pages/group/group.page.module').then( - // (m) => m.AppGroupPageModule - // ) - // }, - // { - // path: 'chat', - // loadChildren: () => - // import('./pages/chat/chat.page.module').then( - // (m) => m.AppChatPageModule - // ) - // }, - // { - // path: 'call', - // loadChildren: () => - // import('./pages/call/call.page.module').then( - // (m) => m.AppCallPageModule - // ) - // }, - // { - // path: 'message', - // loadChildren: () => - // import('./pages/message/message.page.module').then( - // (m) => m.AppMessagePageModule - // ) - // } - // ] - // }, { path: '**', redirectTo: '/common/e404' diff --git a/src/app/layouts/components/default.layout.component.html b/src/app/layouts/components/default.layout.component.html index ccb265e..2615bc8 100644 --- a/src/app/layouts/components/default.layout.component.html +++ b/src/app/layouts/components/default.layout.component.html @@ -97,17 +97,10 @@
- - +
- - +
diff --git a/src/app/layouts/components/default.layout.component.ts b/src/app/layouts/components/default.layout.component.ts index dd9da8a..6b9d86b 100644 --- a/src/app/layouts/components/default.layout.component.ts +++ b/src/app/layouts/components/default.layout.component.ts @@ -1,26 +1,18 @@ import { Subscription } from 'rxjs'; -import { - Component, - ViewChild, - OnDestroy, - OnInit, - Type, - Injector -} from '@angular/core'; -import { Router, NavigationEnd } from '@angular/router'; +import { Component, ViewChild, OnDestroy, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +import { Store, select } from '@ngrx/store'; import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs'; import { MatSidenav } from '@angular/material/sidenav'; -import { Store, select } from '@ngrx/store'; - import { LogService } from '@ucap/ng-logger'; import { AppSelector } from '@app/store/state'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; -const NAVS = ['/group', '/chat', '/organization', '/message']; +const NAVS = ['group', 'chat', 'organization', 'message']; @Component({ selector: 'app-layouts-default', @@ -34,26 +26,13 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy { @ViewChild('leftSidenav', { static: true }) leftSidenav: MatSidenav; - sidenavComponent: Type; - sidenavInjector: Injector; - contentComponent: Type; - contentInjector: Injector; - private windowSizeSubscription: Subscription; - private routerEventSubscription: Subscription; constructor( private router: Router, - private injector: Injector, private store: Store, private logService: LogService - ) { - this.routerEventSubscription = this.router.events.subscribe((event) => { - if (event instanceof NavigationEnd) { - this.onRoute(event.url); - } - }); - } + ) {} ngOnInit(): void { this.windowSizeSubscription = this.store @@ -69,64 +48,16 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy { } } }); - - this.onRoute(this.router.url); } ngOnDestroy(): void { if (!this.windowSizeSubscription) { this.windowSizeSubscription.unsubscribe(); } - if (!!this.routerEventSubscription) { - this.routerEventSubscription.unsubscribe(); - } } onSelectedTabChange(event: MatTabChangeEvent) { - this.router.navigate([NAVS[event.index]]); - } - - onRoute(url: string) { - this.navTabGroup.selectedIndex = NAVS.findIndex((v) => url.startsWith(v)); - - this.sidenavInjector = Injector.create({ - providers: [{ provide: UCAP_PATH_PARAM, useValue: 'sidenav' }], - parent: this.injector - }); - this.contentInjector = Injector.create({ - providers: [{ provide: UCAP_PATH_PARAM, useValue: 'content' }], - parent: this.injector - }); - - switch (url) { - case '/organization': - import('@app/pages/organization/organization.page.module').then((m) => { - this.sidenavComponent = m.SidenavPageComponent; - this.contentComponent = m.IndexPageComponent; - }); - break; - case '/group': - import('@app/pages/group/group.page.module').then((m) => { - this.sidenavComponent = m.SidenavPageComponent; - this.contentComponent = m.IndexPageComponent; - }); - break; - case '/chat': - import('@app/pages/chat/chat.page.module').then((m) => { - this.sidenavComponent = m.SidenavPageComponent; - this.contentComponent = m.IndexPageComponent; - }); - break; - case '/message': - import('@app/pages/message/message.page.module').then((m) => { - this.sidenavComponent = m.SidenavPageComponent; - this.contentComponent = m.IndexPageComponent; - }); - break; - - default: - break; - } + this.router.navigate([{ outlets: { primary: NAVS[event.index] } }]); } onClickToggleLeftSidenav() { diff --git a/src/app/pages/call/call-routing.page.module.ts b/src/app/pages/call/call-routing.page.module.ts index 94708a1..5ec90d3 100644 --- a/src/app/pages/call/call-routing.page.module.ts +++ b/src/app/pages/call/call-routing.page.module.ts @@ -1,7 +1,20 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +import { IndexPageComponent } from './components/index.page.component'; +import { SidenavPageComponent } from './components/sidenav.page.component'; + +const routes: Routes = [ + { + path: 'index', + outlet: 'content', + component: IndexPageComponent + }, + { + path: '', + component: SidenavPageComponent + } +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/pages/call/components/index.ts b/src/app/pages/call/components/index.ts index be6f642..c5347e7 100644 --- a/src/app/pages/call/components/index.ts +++ b/src/app/pages/call/components/index.ts @@ -1,3 +1,4 @@ import { IndexPageComponent } from './index.page.component'; +import { SidenavPageComponent } from './sidenav.page.component'; -export const COMPONENTS = [IndexPageComponent]; +export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; diff --git a/src/app/pages/call/components/sidenav.page.component.ts b/src/app/pages/call/components/sidenav.page.component.ts index f016d75..b974a68 100644 --- a/src/app/pages/call/components/sidenav.page.component.ts +++ b/src/app/pages/call/components/sidenav.page.component.ts @@ -3,18 +3,11 @@ import { Router } from '@angular/router'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-call-sidenav', templateUrl: './sidenav.page.component.html', styleUrls: ['./sidenav.page.component.scss'] }) export class SidenavPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info('app-pages-call-sidenav', 'pathParam', this.pathParam); - } + constructor(private logService: LogService) {} } diff --git a/src/app/pages/chat/chat-routing.page.module.ts b/src/app/pages/chat/chat-routing.page.module.ts index 7e66b90..f8e5339 100644 --- a/src/app/pages/chat/chat-routing.page.module.ts +++ b/src/app/pages/chat/chat-routing.page.module.ts @@ -1,7 +1,20 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +import { IndexPageComponent } from './components/index.page.component'; +import { SidenavPageComponent } from './components/sidenav.page.component'; + +const routes: Routes = [ + { + path: 'index', + outlet: 'content', + component: IndexPageComponent + }, + { + path: '', + component: SidenavPageComponent + } +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/pages/chat/components/index.ts b/src/app/pages/chat/components/index.ts new file mode 100644 index 0000000..c5347e7 --- /dev/null +++ b/src/app/pages/chat/components/index.ts @@ -0,0 +1,4 @@ +import { IndexPageComponent } from './index.page.component'; +import { SidenavPageComponent } from './sidenav.page.component'; + +export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; diff --git a/src/app/pages/chat/components/sidenav.page.component.ts b/src/app/pages/chat/components/sidenav.page.component.ts index 016839a..3db9893 100644 --- a/src/app/pages/chat/components/sidenav.page.component.ts +++ b/src/app/pages/chat/components/sidenav.page.component.ts @@ -3,18 +3,11 @@ import { Router } from '@angular/router'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-chat-sidenav', templateUrl: './sidenav.page.component.html', styleUrls: ['./sidenav.page.component.scss'] }) export class SidenavPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info('app-pages-chat-sidenav', 'pathParam', this.pathParam); - } + constructor(private logService: LogService) {} } diff --git a/src/app/pages/group/components/index.page.component.ts b/src/app/pages/group/components/index.page.component.ts index 5765e91..9ac4bd3 100644 --- a/src/app/pages/group/components/index.page.component.ts +++ b/src/app/pages/group/components/index.page.component.ts @@ -2,18 +2,11 @@ import { Component, Inject } from '@angular/core'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-group-index', templateUrl: './index.page.component.html', styleUrls: ['./index.page.component.scss'] }) export class IndexPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info('app-pages-group-index', 'pathParam', this.pathParam); - } + constructor(private logService: LogService) {} } diff --git a/src/app/pages/group/components/index.ts b/src/app/pages/group/components/index.ts new file mode 100644 index 0000000..c5347e7 --- /dev/null +++ b/src/app/pages/group/components/index.ts @@ -0,0 +1,4 @@ +import { IndexPageComponent } from './index.page.component'; +import { SidenavPageComponent } from './sidenav.page.component'; + +export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; diff --git a/src/app/pages/group/components/sidenav.page.component.ts b/src/app/pages/group/components/sidenav.page.component.ts index 0f4a98f..027ea39 100644 --- a/src/app/pages/group/components/sidenav.page.component.ts +++ b/src/app/pages/group/components/sidenav.page.component.ts @@ -2,22 +2,11 @@ import { Component, Inject } from '@angular/core'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-group-sidenav', templateUrl: './sidenav.page.component.html', styleUrls: ['./sidenav.page.component.scss'] }) export class SidenavPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info( - 'app-pages-group-sidenav', - 'pathParam', - this.pathParam - ); - } + constructor(private logService: LogService) {} } diff --git a/src/app/pages/group/group-routing.page.module.ts b/src/app/pages/group/group-routing.page.module.ts index 7e754b4..c2bb4fe 100644 --- a/src/app/pages/group/group-routing.page.module.ts +++ b/src/app/pages/group/group-routing.page.module.ts @@ -1,7 +1,20 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +import { IndexPageComponent } from './components/index.page.component'; +import { SidenavPageComponent } from './components/sidenav.page.component'; + +const routes: Routes = [ + { + path: 'index', + outlet: 'content', + component: IndexPageComponent + }, + { + path: '', + component: SidenavPageComponent + } +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/pages/message/components/index.ts b/src/app/pages/message/components/index.ts new file mode 100644 index 0000000..c5347e7 --- /dev/null +++ b/src/app/pages/message/components/index.ts @@ -0,0 +1,4 @@ +import { IndexPageComponent } from './index.page.component'; +import { SidenavPageComponent } from './sidenav.page.component'; + +export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; diff --git a/src/app/pages/message/components/sidenav.page.component.ts b/src/app/pages/message/components/sidenav.page.component.ts index 0f4a98f..027ea39 100644 --- a/src/app/pages/message/components/sidenav.page.component.ts +++ b/src/app/pages/message/components/sidenav.page.component.ts @@ -2,22 +2,11 @@ import { Component, Inject } from '@angular/core'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-group-sidenav', templateUrl: './sidenav.page.component.html', styleUrls: ['./sidenav.page.component.scss'] }) export class SidenavPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info( - 'app-pages-group-sidenav', - 'pathParam', - this.pathParam - ); - } + constructor(private logService: LogService) {} } diff --git a/src/app/pages/message/message-routing.page.module.ts b/src/app/pages/message/message-routing.page.module.ts index 8e65be6..d3303c0 100644 --- a/src/app/pages/message/message-routing.page.module.ts +++ b/src/app/pages/message/message-routing.page.module.ts @@ -2,11 +2,17 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { IndexPageComponent } from './components/index.page.component'; +import { SidenavPageComponent } from './components/sidenav.page.component'; const routes: Routes = [ { path: 'index', + outlet: 'content', component: IndexPageComponent + }, + { + path: '', + component: SidenavPageComponent } ]; diff --git a/src/app/pages/organization/components/index.ts b/src/app/pages/organization/components/index.ts new file mode 100644 index 0000000..c5347e7 --- /dev/null +++ b/src/app/pages/organization/components/index.ts @@ -0,0 +1,4 @@ +import { IndexPageComponent } from './index.page.component'; +import { SidenavPageComponent } from './sidenav.page.component'; + +export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; diff --git a/src/app/pages/organization/components/sidenav.page.component.ts b/src/app/pages/organization/components/sidenav.page.component.ts index fd1a99d..0a5ba39 100644 --- a/src/app/pages/organization/components/sidenav.page.component.ts +++ b/src/app/pages/organization/components/sidenav.page.component.ts @@ -1,23 +1,14 @@ -import { Component, Inject } from '@angular/core'; +import { Component } from '@angular/core'; import { LogService } from '@ucap/ng-logger'; -import { UCAP_PATH_PARAM } from '@app/types/tokens'; - @Component({ selector: 'app-pages-ogranization-sidenav', templateUrl: './sidenav.page.component.html', styleUrls: ['./sidenav.page.component.scss'] }) export class SidenavPageComponent { - constructor( - @Inject(UCAP_PATH_PARAM) private pathParam: string, - private logService: LogService - ) { - this.logService.info( - 'app-pages-ogranization-sidenav', - 'pathParam', - this.pathParam - ); + constructor(private logService: LogService) { + this.logService.info('app-pages-ogranization-sidenav'); } } diff --git a/src/app/pages/organization/organization-routing.page.module.ts b/src/app/pages/organization/organization-routing.page.module.ts index 1849d3b..9593856 100644 --- a/src/app/pages/organization/organization-routing.page.module.ts +++ b/src/app/pages/organization/organization-routing.page.module.ts @@ -1,7 +1,20 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +import { IndexPageComponent } from './components/index.page.component'; +import { SidenavPageComponent } from './components/sidenav.page.component'; + +const routes: Routes = [ + { + path: 'index', + outlet: 'content', + component: IndexPageComponent + }, + { + path: '', + component: SidenavPageComponent + } +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/pages/organization/organization.page.module.ts b/src/app/pages/organization/organization.page.module.ts index 0626149..dfad3dd 100644 --- a/src/app/pages/organization/organization.page.module.ts +++ b/src/app/pages/organization/organization.page.module.ts @@ -5,12 +5,7 @@ import { FlexLayoutModule } from '@angular/flex-layout'; import { AppOrganizationRoutingPageModule } from './organization-routing.page.module'; -import { IndexPageComponent } from './components/index.page.component'; -import { SidenavPageComponent } from './components/sidenav.page.component'; - -export const COMPONENTS = [IndexPageComponent, SidenavPageComponent]; - -export { IndexPageComponent, SidenavPageComponent }; +import { COMPONENTS } from './components'; @NgModule({ imports: [CommonModule, FlexLayoutModule, AppOrganizationRoutingPageModule], diff --git a/src/app/types/tokens.ts b/src/app/types/tokens.ts index ee27c47..2f6db53 100644 --- a/src/app/types/tokens.ts +++ b/src/app/types/tokens.ts @@ -1,5 +1,5 @@ import { InjectionToken } from '@angular/core'; -export const UCAP_PATH_PARAM = new InjectionToken( - '@ucap/app PATH_PARAM' -); +// export const UCAP_PATH_PARAM = new InjectionToken( +// '@ucap/app PATH_PARAM' +// ); From a3f6c4a5889d880ebbe6120cb9ec80c3fd161219 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:59:37 +0900 Subject: [PATCH 2/4] bug fixed --- src/app/layouts/components/default.layout.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/layouts/components/default.layout.component.ts b/src/app/layouts/components/default.layout.component.ts index 6b9d86b..25396bb 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', @@ -57,7 +57,10 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy { } onSelectedTabChange(event: MatTabChangeEvent) { - this.router.navigate([{ outlets: { primary: NAVS[event.index] } }]); + this.router.navigate([ + NAVS[event.index], + { outlets: { content: 'index' } } + ]); } onClickToggleLeftSidenav() { 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 3/4] 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}`) + ); + } } From 63e40bb9668f5f12d350ab062afd82f978e069ae Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:50:16 +0900 Subject: [PATCH 4/4] bug fixed --- src/app/app-routing.module.ts | 1 - .../pages/organization/components/sidenav.page.component.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1a37bb9..161e13c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -37,7 +37,6 @@ const routes: Routes = [ authentication: AppSessionResolver }, children: [ - { path: '', redirectTo: '/organization', pathMatch: 'full' }, { path: 'organization', loadChildren: () => diff --git a/src/app/pages/organization/components/sidenav.page.component.html b/src/app/pages/organization/components/sidenav.page.component.html index d9438a6..00e135e 100644 --- a/src/app/pages/organization/components/sidenav.page.component.html +++ b/src/app/pages/organization/components/sidenav.page.component.html @@ -1,3 +1,3 @@
- sidenav page of ogranization is works!!!! + sidenav page of ogranization is works!