Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An angular-material-multilevel-menu for Angular 6?

I have tried to achieve a multilevel sidenav and I found this that meets my requirements:

angular-material-multilevel-menu

Demo - Note the accordion type

Unfortunately this is created for AngularJS (1.0?), which seems to not work in Angular 6.

My questions are:

  1. Is there any other multilevel sidenav component for Angular 6? Have note found any similar on Google that works.
  2. Is it possible to "upgrade" this Angular 1.0 menu to Angular 6? How?
  3. Is there any simple instructions or courses to build your own multilevel side nav? There are many instructions for one-level, but I have found none multi-level.
like image 590
sibert Avatar asked Jun 04 '18 06:06

sibert


People also ask

How do you use matMenuTriggerData?

This is done by typing [matMenuTriggerFor]="app-menu" . The next thing we do is passing the component's member data to the mat-menu through this directive: [matMenuTriggerData]="menuData" . The mat-menu instance that we named app-menu can now grab the content of that member data.

What is matMenuTriggerFor?

Nested menu Material supports the ability for an mat-menu-item to open a sub-menu. To do so, you have to define your root menu and sub-menus, in addition to setting the [matMenuTriggerFor] on the mat-menu-item that should trigger the sub-menu: content_copy.

How do I create a menu in angular 10?

By adding #menu=”mdMenu” to the element the menu template variable is created. The menu consists of three menu items. Each item is added to the template by using a button element and adding the md-menu-item directive to the button element. The md-icon element is used to display an icon next to the menu item text.


2 Answers

I don't know if you are still looking for angular-material-multilevel-menu but I have found one made by ShankyTiwari. Here is the link for GitHub and the link for the demo.

Very easy to use and to implement. For example, I implemented it in a sidebar because it does not exist with Angular material. If not an alternative would be PrimeNG as @Dino said.

like image 137
PierBJX Avatar answered Oct 04 '22 06:10

PierBJX


Angular Material 6.0 doesn't come with multilevel menu out of the box. You would have to create it on your own. It would be a combination of Nested Menu, and Side Nav.

And to answer your first question, I'd suggest you to take a look at PrimeNG's Panel Menu. It does exactly what you need and with some little effort, you'll also be able to change it's design into Material like. (I did it with some PrimeNG components, so I can confirm that it works.

Please take in consideration that PrimeNG 6.0.0 is currently in Alpha-2 version.

like image 22
Dino Avatar answered Oct 04 '22 06:10

Dino