'Angular: My left nav will collapse if there is a route change. Is it possible to prevent it to collapse?

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source