hide menu item in 2.0

Post Reply
mthor1979
Posts: 79
Joined: 03 Mar 2016, 07:26

31 Jan 2017, 07:29

now that the menu is done on the .ts page with a array this.model = [{label:dashboard, icon: 'dashboard', routerLink: ['/']}]

how do we hide a menu item , I have many use cases where I need to hide/show menu items, not sure how to do with the latest release

thanks

User avatar
DarthMaul
Posts: 583
Joined: 23 Nov 2015, 21:20

31 Jan 2017, 08:30

Hi,

Can you explain it more spesific afterwards i will try to replicate and achieve it.

mthor1979
Posts: 79
Joined: 03 Mar 2016, 07:26

31 Jan 2017, 15:50

I will try to explain a little more. in the left side menu, (dashboard, customize, theme) I have other menu names ex.) password, pin, voicemail, speeddials...

some of my users can not see the menu link voicemail, cause they do not have access to our voicemail system. so when this user logs into our application we return a flag (voicemailEnabled: false). When I see this value as false, I need to hide the menu item link voicemail. usually I have them hidden by default and then show the menu item if voicemailEnabled === true.

does that help explain a little better?


The way I can come up with is to create my menu array based on the data then push those menu items to the model array. is there a better solution?


thanks

User avatar
DarthMaul
Posts: 583
Joined: 23 Nov 2015, 21:20

31 Jan 2017, 15:57

Maybe you can try using *ngIf = voicemailEnabled for deleting it from dom.

cagatay.civici
Prime
Posts: 18146
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

31 Jan 2017, 17:54

How about removing it from your model so that it will be removed from dom as well.

Another approach would be;

https://github.com/primefaces/primeng/issues/1959

Where we'll bind the visible property to ngIf in menu of Ultima.

mthor1979
Posts: 79
Joined: 03 Mar 2016, 07:26

31 Jan 2017, 19:13

good options, thanks

mohammed ameen534
Posts: 1
Joined: 03 Oct 2019, 08:40

03 Oct 2019, 08:49

Hi did you get any solution ?? please let me know .. my situation is also same like @mthor .i need to hide/show the label from menu item based on condition

Post Reply

Return to “Ultima - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests