Keep menu-item expanded after click

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
piedfork
Posts: 3
Joined: 16 Jan 2018, 20:58

14 May 2021, 20:26

Hi, I'm using angular and freya v10. I've a left side menu with 2 levels which is working correctly. But when I click on a submenu the parent menu-item is collapsed. Is there a possibility to keep the parent menu-item open?

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

14 May 2021, 23:23

Hi,
Could you check your parent route links, like;

Code: Select all

{
    label: 'UI Kit', icon: 'pi pi-fw pi-star', routerLink: ['/uikit'],
    items: [
        {label: 'Form Layout', icon: 'pi pi-fw pi-id-card', routerLink: ['/uikit/formlayout']},
        //other routes
}
Also, your code must contain constructor, ngOnInit and updateActiveStateFromRoute() function parts in app.menuitem.component.ts file.

piedfork
Posts: 3
Joined: 16 Jan 2018, 20:58

15 May 2021, 15:59

Hi

Thanks for the reply, my issue was indeed the routerlink.
The path of the submenu must begin with the part of the parent. Like in your example /uikit, this was not the case in my code. Now it works.

thanks.

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

18 May 2021, 15:48

Glad to hear :)

Post Reply

Return to “Freya - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests