Basic Usage
The vertical menu component is used to create a vertical navigation menu with expandable and collapsible items. In this example, we create a vertical menu with several items, including headers, dividers, and nested items.
Using MenuItem[] as source
You can also provide menu items using an array of MenuItem objects. This is useful when you want to generate the menu dynamically or load it from a configuration.
Show conditions
You can control the visibility of menu items based on user claims.
In this example, some menu items are only visible if the user has specific claims such as 'salesperson' or 'bartender'. This is done using the user property of the MenuItem interface. Available values for user property are:
user: null- Item is always visible, regardless of user identity.user: true- Item is visible only if the user is authenticated.user: false- Item is visible only if the user is not authenticated.user: { any: ['claim1', 'claim2'] }- Item is visible if the user has at least one of the specified claims.user: { all: ['claim1', 'claim2'] }- Item is visible if the user has all of the specified claims.
Item Template
You can customize the appearance of menu items using the ng1VerticalMenuItemTemplate directive. This allows you to define a custom template for rendering menu items, giving you full control over their layout and styling.