Created
February 4, 2019 20:39
-
-
Save taylor8294/218bb2fca75c89064b8575f7c9f0352b to your computer and use it in GitHub Desktop.
How to add badges to PrimeNG panelMenu MenuItem's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Enable badges in menu items | |
| .ui-panelmenu-header, .ui-menuitem { | |
| position: relative; | |
| } | |
| .ui-menuitem-text .badge{ | |
| position: absolute; | |
| right: 1.5em; | |
| top: 1.4em; | |
| top: calc(0.714em + 7px); | |
| } |
Author
Yes.. el.appendChild works.
Thank you :)
It seams PrimeNG adds a neat way to do it. But even when I set badge and badgeStyleClass to the menu item's model, nothing happen! Is there anyone who used this feature?
I am having the same problem, and paid for premium "designer", the documentation is lacking with numerous components... Don't reference the menuModel if you can't actually use all the options with it... be explicit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was written to work with PrimeNG 7.0.5 early last year, if this hack is still needed and hasn’t been made into a standard feature of the library yet, it sounds like it will need tweaking to work with latest versions. Off the top of my head, try changing
el.nextSibling.appendChildat the bottom of the component to justel.appendChild, see if that fixes you’re problem.