Page 1 of 1

Set Menu Item Active

Posted: 16 Sep 2021, 17:53
by contactvpatel
I have a CRUD operation Page as example Manage Products in which on Create, I am not showing Create Product in Popup but showing in full page. But when I do that, I loose active menu from navigation. How do I programmatically set active menu for any page?


Image

Re: Set Menu Item Active

Posted: 28 Sep 2021, 19:44
by merve7
Hi,
Maybe you can use 'updateActiveStateFromRoute(app.menuitem.component.ts) function for setting active class programmatically. Like;

Code: Select all

        this.active = this.router.isActive(this.item.routerLink[0] || your_url(create page url), this.item.items ? false : true);
or you can change this class value

Code: Select all

        '[class.active-menuitem]': '(active && !root) || (active && appMain.isSlim())'
Best regards,
Merve Özçifçi