1

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): enter image description here

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.

zhinee
  • 105
  • 1
  • 10
  • I need more info to start digging. There're different ways that results in this behavior. One, you have two layout components the first one contains the navbar and the other one is blank and only contains the router-outlet. Other one, there's a condition used on the navbar using `[hidden]` or `*ngIf=""` that hides navbar if current route is **unauthorized**. – Ahmed Shehatah Mar 09 '22 at 23:31

0 Answers0