Hello,
I have problem about navgation extend
For example i have two menu item
new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}']),
new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}'], [], null, { eventType: 'Meeting' })
Second menu item have query parameter but when i click menu items, navigation extend both menu items
2 Answer(s)
-
0
I think your use case of matching exact query parameters is generally not appropriate, but you can achieve it as follows.
app-navigation.service.ts:
- new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}']), + new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}'], [], null, {}), new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}'], [], null, { eventType: 'Meeting' })
side-bar-menu.component.ts:
isMenuItemIsActive(item): boolean { ... - let urlTree = this.router.parseUrl(this.currentRouteUrl.replace(/\/$/, '')); + let urlTree = this.router.parseUrl(this.router.url); let urlString = '/' + urlTree.root.children.primary.segments.map(segment => segment.path).join('/'); let exactMatch = urlString === item.route.replace(/\/$/, ''); + if (exactMatch & item.parameters) { + const itemParamsKeys = Object.keys(item.parameters); + exactMatch = itemParamsKeys.length === Object.keys(urlTree.queryParams).length && itemParamsKeys.every(key => item.parameters[key] === urlTree.queryParams[key]); + } ... return exactMatch; }
-
0
Thank you, will you add that next version?