gpt4 book ai didi

Resolve dynamic nested tabs with privleges in angular(以角度解析具有权限的动态嵌套选项卡)

转载 作者:bug小助手 更新时间:2023-10-25 21:40:47 25 4
gpt4 key购买 nike



I have two levels of tabs in angular application[See Image1],
The 2nd level tabs is privilege controlled, i.e., if the user has access to the tab it will show otherwise not. For ex:, On clicking the Dashboard Tab if user has access to only SelfService2, by default user should be able to see SelfService2 component and that tab should be active.

我在角度应用程序中有两个级别的选项卡[参见Image1],第二个级别的选项卡是受权限控制的,也就是说,如果用户有权访问选项卡,它将显示否则不会显示。例如,如果用户只能访问SelfService2,则在单击Dashboard选项卡时,默认情况下,用户应该能够看到SelfService2组件,并且该选项卡应处于活动状态。


I have a TabComponent which is common for rendering the second level tabs.
Normal routing works fine, i.e., if I click on Dashboard then based on the privilege whichever is the first component that will be visible to user.

我有一个TabComponent,它通常用于呈现第二级选项卡。正常布线工作正常,也就是说,如果我单击Dashboard,则根据用户可以看到的第一个组件的权限。


I am facing issue if I click on Dashboard again, in this case the second level tabs are shown but the default component is not rendered[See Image2]

如果再次单击Dashboard,我将面临问题,在这种情况下,会显示第二级选项卡,但不会呈现默认组件[请参阅Image2]


Image1 (https://i.stack.imgur.com/mHtxn.png)

图片1(https://i.stack.imgur.com/mHtxn.png)


Image2 (https://i.stack.imgur.com/w7Vcs.png)

图片2(https://i.stack.imgur.com/w7Vcs.png)


Stackblitz
https://stackblitz.com/edit/stackblitz-starters-reyyk9

Stackblitz https://stackblitz.com/edit/stackblitz-starters-reyyk9


I am not able to figure out how to detect the default route when clicking on the parent tab, setting the default route in routing module is not an option since I want it to be dynamic, I was thinking if there could be a way where we can dynamically set the default route for the children routes.

当点击Parent选项卡时,我不知道如何检测默认路由,在Routing模块中设置默认路由不是一个选项,因为我希望它是动态的,我在想是否有一种方法可以为子路由动态设置默认路由。


更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com