Angular:如果路线发生变化,我的左侧导航将会崩溃。是否可以防止其崩溃?
我正在使用我公司自己的 UI 库来定义我的左侧导航项:
export const appNavItems: NavItem[] = [
{
name: 'Request',
route: '/request',
subItems: [
{
name: 'View Requests',
route: '/request/view-request'
},
{
name: 'Create Project',
route: '/request/create-project'
}
]
}
];
如果我转到 ViewRequest 屏幕,左侧导航不会折叠。 但是,如果我去创建项目。创建项目有一个 Route Guard,它将执行:
this.router.navigateByUrl('/request/unauthorized');
return false;
导航后(它导航到未经授权的组件),我的左侧导航栏将崩溃。
有没有办法防止它塌陷呢?
谢谢。
I am using my company's own UI library to define my left nav items:
export const appNavItems: NavItem[] = [
{
name: 'Request',
route: '/request',
subItems: [
{
name: 'View Requests',
route: '/request/view-request'
},
{
name: 'Create Project',
route: '/request/create-project'
}
]
}
];
So the left nav looks like this (expanded):
If I go to ViewRequest Screen, the left nav does not collapse.
But, If I go to Create Project. The Create Project has a Route Guard, and it will execute :
this.router.navigateByUrl('/request/unauthorized');
return false;
After the navigation ( it navigated to unauthorized component) , my left nav bar will collapse.
Is there a way to prevent it to collapse?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论